Skip to content

Instantly share code, notes, and snippets.

@outsideris
Last active August 24, 2016 03:25
Show Gist options
  • Save outsideris/0db7fb07ebd8b6071e73e971b7bcafba to your computer and use it in GitHub Desktop.
Save outsideris/0db7fb07ebd8b6071e73e971b7bcafba to your computer and use it in GitHub Desktop.
'use strict';
function test1() {
console.log('-- test1 --');
console.log(x);
try {
console.log(y);
} catch(e) { console.log(e); }
var x = 0;
let y = 0;
}
function test2() {
console.log('-- test2 --');
foo();
try {
bar();
} catch(e) { console.log(e); }
try {
baz();
} catch(e) { console.log(e); }
function foo() { console.log('foo'); }
var bar = function() { console.log('bar'); }
let baz = function() { console.log('baz'); }
}
test1();
test2();
-- test1 --
undefined
[ReferenceError: y is not defined]
-- test2 --
foo
[TypeError: bar is not a function]
[ReferenceError: baz is not defined]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment