-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfunction.js
54 lines (35 loc) ยท 831 Bytes
/
function.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
function square(number){
return number * number;
}
square(2); //ํจ์์ ์ฌ์ฌ์ฉ
var foo = function multiply(a,b){
return a*b;
}
var bar = function(a,b){ // ์ต๋ช
ํจ์
return a*b;
}
console.log(foo(10,5))
console.log(bar(10,5));
var res = squ(5);
function squ(number){
return number * number;
}
// ์ฝ๋ ๋ด ์ด๋ ๊ณณ์์๋ ์ง ํธ์ถ์ด ๊ฐ๋ฅ >> ํจ์ ํธ์ด์คํ
var increase = function(num){
return ++num;
};
var decrease = function(num){
return --num;
};
var predicates = { increase, decrease };
function makeCounter(predicate){
var num = 0;
return function() {
num = predicate(num);
return num;
}
}
console.log(Math.ceil(1.4)); // ์ฌ๋ฆผ
console.log(Math.floor(-1.9)); // ๋ด๋ฆผ
const arr = [1,2,3];
console.log(Math.min.apply(null, arr));