JS λ°μ΄ν°(μλ£ν, Date Type)
μμν
- λ¬Έμ
- μ«μ
- λΆλ¦°
- null
- undefined
- μ¬λ³Ό
- ν°μ μ(BigInt)
μ°Έμ‘°ν
- λ°°μ΄
- κ°μ²΄
- ν¨μ
λ¬Έμ
λ°μ΄νλ‘ λ¬Άμ¬ μμ΄μΌ ν¨!
"Heropy"
'heropy'
`heropy`
μ«μ
NaN : μ«μλ‘ νμκ° λΆκ°! (μ«μλ°μ΄ν°)
NaN
boolean
true
false
null
κ°μ΄ μμμ λͺ μμ μΌλ‘ λνλΌ λ μ°λ κ°(λ°μ΄ν°)
undefined
κ°μ΄ ν λΉλμ§ μμ μνλ₯Ό μμμ μΌλ‘ λνλ
μ¬λ³Ό
μ μΌν μλ³μ(ID) λ°μ΄ν° μ΄λ¦μ λ§λ€ λΌ μ¬μ©
const s = Symbol('hello world!')
const user = {
name: kmjin
[s]: 92
}
console.log(user.name)
console.log(user[s])
BigInt
ν° μ μ (Integer)
123n
λ°°μ΄
κ°μ²΄
ν¨μ
νλ³ν
== λλ±μ°μ°μ) : νλ³νν΄μ λΉκ΅ν¨ (μ¬μ©νμ§λ§κ²)
=== (μΌμΉ μ°μ°μ) : λ©λͺ¨λ¦¬ μ£Όμλ₯Ό λΉκ΅
truthy & falsy
falsy
false
null
undefined
0
-0
NaN
0n
'' // κ³΅λ°±μ΄ μλ€λ©΄ truthy
μλ£ν νμΈ
- typeof (null array λ λΆκ°)
- Array.isArray({})
- Object.protptype.toString.call
function checkType(parameter){
return Object.prototypw.toString.call(paremeter).slice()
}
console.log(checkType(argument))
λ³μ
- const
- scope : block level
- μ¬ν λΉ : x
- μ€λ³΅ μ μΈ : x
- Hoisting : x
- μ μ λ±λ‘ : x
- let
- scope : block level
- μ¬ν λΉ : o
- μ€λ³΅ μ μΈ : x
- Hoisting : x
- μ μ λ±λ‘ : x
- var
- scope : function level
- μ¬ν λΉ : o
- μ€λ³΅ μ μΈ : o
- Hoisting : x
- μ μ λ±λ‘ : O
- Hoisting : μ μΈλΆλ₯Ό μ ν¨λ²μ μ΅μμλ‘ λμ΄μ¬λ €μ§λ νμ
- μ μ (Global) μ μΈμ μ μ κ°μ²΄(
window
)μ μμ±μΌλ‘ λ±λ‘ - μΌλ¨ const λ‘ μ°κ³ μ¬ν λΉμ΄ νμν΄μ§λ©΄ let
ν¨μ
μ μΈκ³Ό νν
//ν¨μ μ μΈ
function abc() {
}
//ν¨μ νν
const abc = function () {
}
- ν¨μ μ μΈ
- νΈμ΄μ€ν 0
- ν¨μ νν
- μ΄λ¦μ΄ μκ³ κ°μΌλ‘ μ¬μ©λλ ν¨μ
- νΈμ΄μ€ν 0
λ°μν
'π TIL' μΉ΄ν κ³ λ¦¬μ λ€λ₯Έ κΈ
[220421] μ°μ°μ/if /switch (0) | 2022.04.22 |
---|---|
[220419] export / import / lodash / Json (0) | 2022.04.19 |
[220417] Data type / λ΄μ₯ λ©μλ (0) | 2022.04.18 |
[220415] switch statement (0) | 2022.04.15 |
[220412] grid (0) | 2022.04.13 |