Is it possible or is there a workaround to use Razor syntax within JavaScript that is in a view (cshtml)?
I am trying to add markers to a Google map...
There is also one more option than @: and .
Using block itself.
When you need to do large chunks of JavaScript depending on Razor code, you can do it like this:
@if(Utils.FeatureEnabled("Feature")) {
}
Pros of this manner is that it doesn't mix JavaScript and Razor too much, because mixing them a lot will cause readability issues eventually. Also large text blocks are not very readable either.