Welcome to JS Bin
Load cached copy from
 
<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width">
    <title>JS Bin</title>
  </head>
  <body>
  </body>
</html>
 
if (true) {
    // this 'if' conditional block creates a new scope because we use 'let'
  const name = 'Prince' // name is local to the if block
  console.log(name) // logs 'Prince' 
}
console.log('----')
console.log(name) // <--- prints nothing because the 'name' variable can only be accessed from within the block (due to the use of 'let')
Output

You can jump to the latest bin by adding /latest to your URL

Dismiss x