Flashcards
Scope

Flashcards do conjunto (9)
- 1How many kinds of scope exist3. Local Scope(Function Scope), Global Scope, Block Scope
- 2—myName is not defined

- 3—myName is not defined

- 4—going down in scope works, variables in outer scope are accessible from inner scope but not the other way round, so myName is reachable inside printInfo

- 5What is scopeScope is about visibility of variables, it is a concept that defines or explains where in code you can use which variables or functions. It controls which variables or functions you defined somewhere can be used in which line of code
- 6What is contextContext is a different concept, not about visibility of variables. Context refers to the Object a Function belongs to. It is a concept that in the end explains what the this keyword used in a function that’s part of an object refers to.
- 7Local and global scopeLocal and global scopes are important if working with var. If defining variable with var you are dealing with local and global scope
- 8Block scopeBlock scope is different from variables with var because it gives us more places in code where we create new scope, essentially everywhere where we use curly braces for example in for loops, if statements (as long it is not for creating object). Whenever we use curly braces and let/const inside of curly braces you define and declare you define and declare variable inside of that block which is surrounded by that pair of curly braces.
for/while loops, if/switch statements don't have own scope if using var - 9var vs let in if statement

Informações
- Descrição
- Scope FlashCards sobre Scope, criado por milly larcen em 14-04-2020.
- Criado por
- milly larcen
- Visualizações
- 0
- Avaliação