
1. let
let os = 'mac';
console.log(os); // mac
os = 'linux';
console.log(os); // linux
2. const
security
thread safety
reduce human mistakes
const os = 'windows';
console.log(os); // windows
3. var
os = 'mac';
console.log(os); // mac
var hoisting
- 선언 위치와 상관없이 맨 위로 선언 됨
1. number
const Num1 = 2030; // 정수(intege
const Num2 = 20.5; // 소수(decimal)
const Infinity = 1 / 0; // 숫자를 0으로 나누게 되면 인피니티
const Negativeinfinity = -1 / 0; // 마이너스 값을 0으로 나누게 되면 네거티브 인피니티
const NaN = '1' / 2; // 숫자가 아닌 문자를 0으로 나누게 되면 NaN(not a number)
2. string
const Char = 'c';
const first_Name = '윤';
const last_Name = '승근';
const Name = first_Name + last_Name // + 기호를 이용 한 문자열 합치기
console.log(Name) // 윤승근
console.log('10' + 1000); // 101000 문자열에 숫자를 더하게 되면 숫자가 문자로 변환
3. boolean
const people = true; // 변수에 할당 가능
const Test = 20 > 50 // false
4. null
let nothing = null;
5. undefined
let A;
let A = undefined
5. symbol
const symbol1 = Symbol('id');
const symbol2 = Symbol('id');
console.log(symbol1 === symbol2) // false