As a corollary to this question, I know it's possible to represent cast an MVC ViewModel object to Javascript using some technique like var jsObject = @Html.Raw(Json.Encode(Model)).
I'm assuming it's only possible to use this technique directly on the actual .cshtml page. What if I wanted to us this data in an external .js file?
If I instantiated var jsObject on the .cshtml page, could I still access this object from an external Javascript file, or would it be considered to be out-of-scope?