반응형
let test = ' ';
console.log('[test]', test);
if (test) console.log('[TRUE]'); //' ', 1, -1, 1 / 0=Infinity,[],{}, () => {}
else console.log('[FALSE]'); //undefined,null,'', false, 0, 0 / 0=NaN
반응형
'js > js syntax' 카테고리의 다른 글
{...{id:1,value:일},id:2} ->젤 뒤에 오는 2가 앞의 1을 덮어버림, 앞에 위치한 값은 없어짐 (0) | 2024.02.07 |
---|---|
1->01: (1+'').padStart(2,'0'), (1).toLocaleString('en-US',{minimumIntegerDigits:2}) (0) | 2024.01.31 |
js reduce function (0) | 2022.08.22 |
js empty array check: arr?.length===0 (객체이면 arr.length는 undefined) (0) | 2022.07.11 |
js template literal에서 삼항연산자(a?b:c, ternary operator) 사용 (0) | 2022.06.02 |