for(let i = 1; i < 10; i++) { let foo = "bar"; } console.log(i); // undefined console.log(foo); // undefined
const FOO = "bar";
'use strict'; function f() { return 1; } { function f() { return 2; } } return f() === 1;
BLOCK LEVEL FUNCTION DECLARATIONS
function sum(a = 1, b = 2) { return a + b; }; sum(); // 3
function foo(a = 1, b = a) { // some code } foo(undefined, 3);
var sum = (x,y) => x+y;
var numbers = [1,2,3,4,5]; var timesTwo = numbers.map((number) => number * 2); console.log(timesTwo); // [2, 4, 6, 8, 10]
By Subin Varghese