Skip to content

Instantly share code, notes, and snippets.

@rogerwschmidt
Last active June 12, 2017 18:32
Show Gist options
  • Select an option

  • Save rogerwschmidt/de8ca8e3ef3df7a6daa57c1e0ff0abbc to your computer and use it in GitHub Desktop.

Select an option

Save rogerwschmidt/de8ca8e3ef3df7a6daa57c1e0ff0abbc to your computer and use it in GitHub Desktop.

Scope Instructor Notes

Objectives

  • Define what scope is
  • Explain the three types of scope.
  • Explain what hoisting is, and when it occurs
  • Identify which scope data is stored in.

What is scope?

Turn your neighbor and explain what scope is. Be prepared share with the class.

What are the three types of scope?

Turn to your neighbor and name the three different types of scope

What is hoisting, and when does it occur?

Turn to your neighbor and define hoisting, and when it occurs.

Where is data stored in?

var name = 'Roger' // <- where is this stored?

function toUpper(name){
  var upperName = name.toUpperCase() // where are these stored?
  return upperName
}
for(var i = 0; i < 10; i++){ // where is `i` stored?
  console.log(i)
}

for(let i = 0; i < 10; i++){ // where is `i` stored?
  console.log(i)
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment