Coggle requires JavaScript to display documents.
let
function test() { let num1 = 1; if (num1 === 1) { let num2 = 10; console.log(num1, num2); } console.log(num1, num2); } test();
> Uncaught ReferenceError: num2 is not defined
num2
num1
test
var fn1 = function() { var a = 2, b = 3; var fn2 = function() { console.log(a + b); }; fn2(); }
> fn1()
> 5 > undefined
5
var fn1 = function() { var a = 2, b = 3; var fn2 = function() { console.log(a + b); }; setTimeout(fn2, 3000); }
> undefined > 5
undefined
fn1
fn2
a
b