<body>
<script type="text/javascript">
@{ int count = 1; }
var words = '@Model.FirstOrDefault(n => n.ID == count).Content';
@{count++;}
</script>
</body>
I was anticipating that it would increment every time I come across this block, but it only increments once. Additionally, I am unable to use a JavaScript variable because passing it to the first or default function is not feasible.