Last active
June 24, 2021 13:30
-
-
Save vikneshwar/45d24e8b99dbdb088de35bd199d60a2a to your computer and use it in GitHub Desktop.
Revisions
-
vikneshwar revised this gist
Jun 24, 2021 . 1 changed file with 22 additions and 21 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,14 +1,14 @@ //pure functions //given a input will always return a same output //will not cause side effects const add = (a, b) => a + b; //impure function 1 const magicLetter = "*"; const createMagicPhrase = (phrase) => `${magicLetter}abra${phrase}`; //impure function 2 const fetchLoginToken = externalAPI.getUserToken; //Closure //Ex: @@ -21,46 +21,47 @@ console.log(x); //2 //let and const are hoisted but not assigned a value so will throw error //Ex: var x = 10; { console.log(x); //throws undefined error let x = 20; } //IIFE // Why IIFE var x = 10; console.log(x); (function () { console.log(x); var x = 2; console.log(x); })(); // .call .apply .bind // ES6 Features // Node Architecture if (new Boolean(false)) { console.log("TEST"); } //function hoisting foo(); var foo = function () { console.log("TEST"); }; //Promises let data = { name: "viknesh", }; let data_1 = data; data_1.name = "xyz"; console.log(data); //first class functions // node advantage vs disadvantage -
vikneshwar revised this gist
Mar 22, 2019 . 1 changed file with 13 additions and 3 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -11,11 +11,21 @@ const createMagicPhrase = (phrase) => `${magicLetter}abra${phrase}` const fetchLoginToken = externalAPI.getUserToken //Closure //Ex: //Hoisting //Ex: console.log(x); // undefined var x = 2; console.log(x); //2 //let and const are hoisted but not assigned a value so will throw error //Ex: var x = 10 { console.log(x); //throws undefined error let x = 20 } //IIFE // Why IIFE -
vikneshwar revised this gist
Mar 6, 2019 . 1 changed file with 3 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -51,4 +51,6 @@ let data = { let data_1 = data; data_1.name = "xyz" console.log(data); //first class functions -
vikneshwar revised this gist
Mar 6, 2019 . No changes.There are no files selected for viewing
-
vikneshwar revised this gist
Mar 6, 2019 . 1 changed file with 43 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -9,3 +9,46 @@ const createMagicPhrase = (phrase) => `${magicLetter}abra${phrase}` //impure function 2 const fetchLoginToken = externalAPI.getUserToken //Closure //Hoisting console.log(x); var x = 2; console.log(x); //IIFE // Why IIFE var x = 10; console.log(x); (function(){ console.log(x); var x = 2; console.log(x); })(); // .call .apply .bind // ES6 Features // Node Architecture if(new Boolean(false)) { console.log("TEST") } //function hoisting foo() var foo = function(){ console.log("TEST") } //Promises let data = { name: "viknesh" }; let data_1 = data; data_1.name = "xyz" console.log(data); -
vikneshwar created this gist
Mar 6, 2019 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,11 @@ //pure functions //given a input will always return a same output //will not cause side effects const add = (a,b) => a + b; //impure function 1 const magicLetter = '*' const createMagicPhrase = (phrase) => `${magicLetter}abra${phrase}` //impure function 2 const fetchLoginToken = externalAPI.getUserToken