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 characters
add(1,2);//μλ¬ λ°μ | |
var add = function(a,b) { | |
return a + b; | |
}; | |
add(1,2);//3 λ°ν |
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 characters
var add = new Function('a','b','return a + b'); | |
add(1,2);//3 λ°ν |
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 characters
var factorial = function factorialFunc(num) { | |
if(num <= 1) { | |
return num; | |
} | |
return (num * factorialFunc(num-1)); | |
}; | |
console.log(factorial(3));//6 λ°ν |
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 characters
add(1,2);//3 | |
function add(a,b) { | |
return a + b; | |
} | |
add(3,4);//7 |
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 characters
var add = function plus(a,b) { | |
return a + b; | |
} |
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 characters
var add = function(a,b) { | |
return a + b; | |
} |
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 characters
function add(a,b) { | |
return a + b; | |
} |
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 characters
var a = [1,2,3,4,5]; | |
a.splice(1,2); | |
console.log(a);//[1,4,5] μΆλ ₯ | |
a.splice(3,0,'a','was',[1,4,5]); | |
console.log(a);//[1, 4, 5, "a", "was", Array(3)] μΆλ ₯ |
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 characters
var a = [1,2,3,4]; | |
delete a[1]; | |
console.log(a);//[1,empty,3,4] μΆλ ₯ |
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 characters
var a = [1,2,3,4,5,6];//λ°°μ΄ μμ± | |
console.log(a.length);//6 μΆλ ₯ | |
a.length = 2; | |
console.log(a.length);//2 μΆλ ₯ | |
console.log(a);//[1,2] μΆλ ₯ |