Now look at example if the one titled foo is just a function again. So foo is just back to being a function, it's not a constructor, I don't instantiate it. And on line 61, I learned speed equals 100. Or I say speed equals 100. And then on 63, I learned this dot speed. So copy that code and refresh the page and paste that code in your browser.
And we get 100. So up until now, in a lot of these examples we've gotten on defined but in this case, we get 100. And the reason is, if you remember that by omitting the var keyword, I wind up with an implied global. So once again, omitting the var keyword is pretty much the same thing as doing this, which is also the same exact thing as doing this, which is also the same exact thing as doing this. Line. 6061 and 62 are all the exact same thing, but regardless On line 63.
By omitting the var keyword, I create an implied global. And we create a property on the window object called speed, which means that on line 64, when we access this speed, we get six we get sick, we get 100. Because we're basically asking for window dot speed. So this is a case once again, where the delay line between scope and contact context can feel fuzzy. Because we're creating a variable here on line 62. There's no doubt about it.
But we're creating an implied global and implied Global's become properties of the window object in browser based JavaScript. So this is where its scope but in a way, it's also context, because we're reaching for the property of an object, and we can access this inside of this function and reference the window object