SEB FE / Section1 / Unit3 / JavaScript κΈ°μ΄ μ μ΄λ¬Έ
π Today I Learned
- ν¨μ μ μΈλ¬Έ
- ν¨μ ννμ
- νμ΄ν ν¨μ
function plus2(input) {
input = input + 2;
return input;
}
console.log(plus2(8));
// expected output: 10
function multiply(a, b) {
a, b = a * b;
return a, b;
}
console.log(multiply(5, 2));
// expected output: 10
let
,const
- λ³μ μ μΈ
function
- ν¨μ μ μΈ
function
μ μΈλ¬Έ μμ let
, const
μ¬μ© μ ν¨μ ννμμ΄ λλ€.
let plus2 = function(input) {
input = input + 2;
return input;
}
console.log(plus2(4));
// expected output: 6
let multiply = function(a, b) {
a, b = a * b;
return a, b;
}
console.log(multiply(3, 4));
// expected output: 12
const plus = new Function('a', 'b', 'return a + b');
console.log(plus(4, 5));
// expected output: 9
맀κ°λ³μκ° νλμΌ λ ()
μλ΅μ΄ κ°λ₯νκ³ , ν¨μ λ΄λΆκ° νλμ λ¬ΈμΌλ‘ ꡬμ±λλ€λ©΄ {}
λ₯Ό μλ΅ν μ μλ€.
let plus2 = input => input + 2;
plus2(3)
// expected output: 5
let multiply = (a, b) => (a * b);
multiply(3, 4)
// expected output: 12
ν¨μ μ μΈλ¬Έμ μμ±νκ³ ννμμΌλ‘ λ°κΏμ μ§λ³΄κ³ , κ·Έκ±Έ λ€μ νμ΄ν ν¨μλ‘ μ§λ³΄λ©΄μ μ’ λ μ΄ν΄ν μ μκ² λ κ² κ°λ€.
function
μ κ°μ λ°ννκ³ λλ©΄ μ’
λ£λλ€.
ν¨μλ ν·κ°λ¦¬κΈ° μ¬μ΄ λ― νλ©΄μ λ΅μ λ± μλ € μ£Όλ κ²μ΄... μ‘°κΈ λ 볡μ΅ν΄ 보μ.
80νΌ μ λλ μ΄ν΄κ° λ κ² κ°λ€.