=== 자료형과 값이 같은지 비교
!== 자료형과 값이 다른지 비교
console.log(`20 == "20" : ${20 == "20"}`);
console.log(`20 == "20" : ${20 === "20"}`);
console.log(`0 == "" : ${0 == ""}`);
console.log(`0 == "" : ${0 === ""}`);
실행결과
20 == "20" : true
20 === "20" : false
0 == "" : true
0 === "" : false
변경하지 않을 대상에 상수를 적용함
const를 사용하여 상수를 지정함
const pi = 3.141592;
pi = "";
console.log(pi);
실행결과
pi = "";
^
TypeError: Assignment to constant variable.
at Object. [90m(C:\Users\jamong\Documents\node\[39mtset1.js:2:4[90m)[39m
[90m at Module._compile (node:internal/modules/cjs/loader:1218:14)[39m
[90m at Module._extensions..js (node:internal/modules/cjs/loader:1272:10)[39m
[90m at Module.load (node:internal/modules/cjs/loader:1081:32)[39m
[90m at Module._load (node:internal/modules/cjs/loader:922:12)[39m
[90m at Function.executeUserEntryPoint as runMain[39m
[90m at node:internal/main/run_main_module:23:47[39m
상수는 값을 변경할 수 없기 때문에 오류를 뿜는다.