10/29/2023 0 Comments You dont know js hoistingWhile multiple/duplicate var declarations are effectively ignored, subsequent function declarations do override previous ones. declaration, because function declarations are hoisted before normal variables. Notice that var foo was the duplicate (and thus ignored) declaration, even though it came before the function foo(). But a subtle detail (that can show up in code with multiple “duplicate” declarations) is that functions are hoisted first, and then variables.ġ is printed instead of 2! This snippet is interpreted by the Engine as: Both function declarations and variable declarations are hoisted.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |