Skip to content

Commit

Permalink
Day 31: Execution context, Arrow Function, hoisting
Browse files Browse the repository at this point in the history
  • Loading branch information
uttu-316 committed Nov 11, 2022
1 parent f931683 commit 88894f2
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 1 deletion.
2 changes: 1 addition & 1 deletion javascript/Day30/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ function printTable(value) {
}

let x = 2;

var y = 3;
printTable(x);
printTable(y);
printTable(4);
Expand Down
38 changes: 38 additions & 0 deletions javascript/Day31/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
var result = 6;

function sum() {
console.log(result);
var two = 2;
var result = two + two;
return result;
}

sum();
//undefined

console.log(window.y);
y = 20;

console.log(window.y);

function abc() {
x = 20;
var h = 30;
console.log(x, h);
}

abc();

console.log(window.x);
console.log(h);

var xyz = function (name) {
console.log("Regular Function " + name);
};

const arrow_function = (name) => {
console.log("Arrow Function " + name);
};

arrow_function("Ahemad");
xyz("utkarsh");

0 comments on commit 88894f2

Please sign in to comment.