You don't get direct access to C# variables in javascript as one is server-side, the other client-side. You need to write the ViewBag value to the HTML output and then interrogate the DOM to find it using javascript. Something like this:
In your CSHTML:
@Html.Hidden("Mode", (string)ViewBag.Mode, new { id = "mode" })
In jQuery:
if ($('#mode').val() == "EDIT") {
// do something...
}
You could also wrap the JS code directly in a C# if (ViewBag.Mode == "EDIT")
statement in your view, however this is both ugly, and not a good separation of concerns.