ASP MVC Razor if statement with javascript inside
<p>This is what I'm trying to do in my view:</p>

<pre><code>&lt;script type="text/javascript"&gt;
    @if (ViewBag.scroll != null)
    {
        console.log("viewbag data: " + @ViewBag.scroll);
    }
    else
    {
        console.log("no viewbag data");
    }
&lt;/script&gt;
</code></pre>

<p>I'd like to execute some jQuery code depending if the <code>ViewBag</code> has data, but it is giving me this error: </p>

<blockquote>
  <p>the name 'console' does not exist in the current context.</p>
</blockquote>