Advertisement
Guest User

Untitled

a guest
Jul 18th, 2019
127
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.13 KB | None | 0 0
  1. What is scope? Your explanation should include the idea of global vs. block scope.- A scope is a set of rules that define how the variables you declare
  2. either can or cannot be accessed at different places in your code. Scopes allow other programmers to add to the same code without it breaking.
  3. Global scope tend to make some side effects happen within code and they should be avoided.Any variable that is defined outside of a function
  4. is a global scope. However a block scope is only accessible within the function's block of instructions.
  5.  
  6.  
  7.  
  8. Why are global variables avoided? Global scope tend to make some side effects happen within code.
  9.  
  10.  
  11.  
  12.  
  13.  
  14. Explain JavaScript's strict mode. The JavaScript 'use strict' command can be put at the top of a file to enforce strict mode for the entire file.
  15. Any time a variable is declared without the let or const keyword, an error will be triggered.
  16.  
  17.  
  18.  
  19.  
  20.  
  21. What are side effects, and what is a pure function? A side effect is when a function reaches outside its local scope up into a parent scope and
  22. alters a value that lives there. A pure function when it is both determinate and has no side effects within our code.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement