InterviewSolution
| 1. |
If You Omit The “var” Keyword When Creating A Variable In A Function, It Becomes A Property Of What Object? |
|
Answer» When omitting the “var” keyword, the variable you create becomes an “implied global”. But implied globals are not VARIABLES in a function. An implied global ACTUALLY becomes a property of the window OBJECT. Although the window object is considered the “global” scope, it is an object, and any variable DECLARED in the global scope (intentionally or otherwise), becomes a property of the window object. When omitting the “var” keyword, the variable you create becomes an “implied global”. But implied globals are not variables in a function. An implied global actually becomes a property of the window object. Although the window object is considered the “global” scope, it is an object, and any variable declared in the global scope (intentionally or otherwise), becomes a property of the window object. |
|