Converting C# List<string> To Javascript
To get rid of the 'syntax error' you just need to remove ; at the end
var imageLinks = @Html.Raw(Json.Encode(Model.ImgLinks))
Despite the warning your code will run fine anyway.
Here's a different kind of solution to the problem if anyone's interested. You can loop through the razor collection and store the values in a Javascript Array like this.
<script type="text/javascript">
var myArray = [];
@foreach (var link in Model.ImgLinks)
{
@:myArray.push("@link");
}
</script>