You can't interact in that way with C# and JavaScript. I would suggest the following: convert the C# array into a JSON string and assign it to a JavaScript variable; inside your <script> parse the array into a valid object:
<script type="text/javascript">
//for debugging purpose use two lines
var jsonArray = '@Html.Raw(Json.Encode(arrayofdetails ))';
var arryObj = JSON.parse(jsonArray);
//alternatively, call "JSON.parse()" directly
//var arryObj = JSON.parse('@Html.Raw(Json.Encode(arrayofdetails ))');
for(int x = 0; x < arryObj.length ; x++)
{
$('#' + arryObj[x]).hide();
}
</script>
NOTE: Since the Json.Encode method produces a JSON string, the values of the properties/arrays will almost always be double quoted (e.g. "myValue"). Constructs such as var jsonString = "{ myProperty: "myValue" }"; are illegal in JavaScript. Therefore, the generated JSON string must be wrapped inside single quotes '.
arrayofdetailsis the list of id's of the html<div>?