I'm using JQuery, latest version.
$(document).ready(function(){
    function ViewModel(){
        this.Impossible = "impossible!";
    }
    let vm = ViewModel();
});
$(window).on("beforeunload", function (e) {
    console.log("this: " + this.Impossible);
    console.log("window: " + window.Impossible);
    // return "Test";
});
https://jsfiddle.net/5wkdxvhq/1/
How is it possible that "impossible!" gets logged? Impossible is wrapped by at least 2 functions, it definitely shouldn't be a global variable, yet there it is.
Is this a behavior of JQuery or JavaScript?
Is this standard behavior that I can rely on? Or is it some quirk that won't work in other browsers/future Knockout updates or a bad design practice by me?
 
     
    