μλ£ν - λ°μ΄ν° μ’
λ₯
1. λΆλ¦¬μΈ boolean
let isEmployed = true;
let isMarried = false;
console.log('μ§μ
μμ:', isEmployed);
console.log('κΈ°νΌ:', isMarried);
>
π μ°Έ λλ κ±°μ§ - μλ°λ λ μ€ νλμ κ°μ λ΄μ μ μμ
μ§μ ν λΉλ기보λ€λ λ°νκ°μΌλ‘ νλ‘κ·Έλ¨ κ³³κ³³μμ νμ©λ¨
2. μ«μ Number
let a = 100;
let b = 12.34;
let c = -100;
console.log(a,b,c);
> 100, 12.34, -100
π μλ°μ€ν¬λ¦½νΈμλ μ μμ μ€μμ ꡬλΆμ΄ μμ
μ μλ μ€μλ‘ μ²λ¦¬ν¨
3. λ¬Έμμ΄ String
let name = subin;
let job = student;
let description = `λ¬Έμμ΄ μμ`
console.log(name, job);
console.log(description);
>subin,student
>λ¬Έμμ΄ μμ
π ν°λ°μ΄ν, μμλ°μ΄ν, λλ λ°±ν±μΌλ‘ λλ¬μΈμΈ ν
μ€νΈ λ°μ΄ν°
4. undefined
let x;
console.log(typeof x);
>undefined
π κ°μ΄ λΆμ¬λμ§ μμ μνλΌλ μλ―Έ
βοΈ κ·Έλ¬λ undefinedλ κ°μ λ€λ₯Έ μΈμ΄λ€κ³Ό λ€λ₯Έ μ
μ무κ²λ λ³ννμ§ μλ ꡬ문 = undefined λ°ν
5. null
let x;
console.log('κ° λ£κΈ° μ ', typeof x);
<>undefined
x = null;
console.log('nullκ° λ£μ ν',typeof x);
>null
π μλμ μΈ λΉ κ°μ μλ―Έ
βοΈ κ·Έλ¬λ nullλ κ°μ. "λΉμ΄μλ€"λ μλ―Έμ κ°
object(κ°μ²΄) λ±μ΄ λ€μ΄μκ±°λ λ°νλμ΄μΌ νμ§λ§ μμ λ μ£Όλ‘ μ¬μ©
κ°μ²΄ μμ±μ΄ μ€ν¨ν κ²½μ° λ±μ λμ λ°ν