let(added in ES6)
let name = 'ellie';
console.log(name);
name = 'hello';
console.log(name);
{
age = 4;
var age;
}
console.log(age);
const daysInWeek = 7;
const maxNumber = 5;
const count = 17; // integer(정수)
const size = 17.1; // decimal number(소수)
console.log(`value : ${count}, type : ${typeof count} `);
console.log(`value : ${size}, type : ${typeof size} `);
const infinity = 1 / 0;
const negativeInfinity = -1 / 0;
const nAn = 'not a number' / 2;
console.log(infinity);
console.log(negativeInfinity);
console.log(nAn);
const bigInt = 1234567890123456789012345678901234567890n;
console.log(`value : ${bigInt}, type : ${typeof bigInt}`);
const char = 'c';
const brendan = 'brendan';
const greeting = 'hello' + brendan;
console.log(`value : ${greeting} type : ${typeof greeting}`);
const helloBob = `hi ${brendan}!`; // template literals (string)
console.log(`value : ${helloBob}, type : ${typeof helloBob}`);
console.log('value : ' + helloBob + ' type : ' + typeof helloBob);
const canRead = true;
const test = 3 < 1; // false
console.log(`value : ${canRead}, type : ${typeof canRead}`);
console.log(`value : ${test}, type : ${typeof test}`);
let nothing = null;
console.log(`value : ${nothing}, type : ${typeof nothing}`);
let x;
console.log(`value : ${x}, type : ${typeof x}`);
const symbol1 = Symbol('id');
const symbol2 = Symbol('id');
console.log(symbol1 === symbol2);
const gSymbol1 = Symbol.for('id');
const gSymbol2 = Symbol.for('id');
console.log(gSymbol1 === gSymbol2);
console.log(`value : ${symbol1.description}, type : ${symbol1.description}`);
let text = 'hello';
console.log(text.charAt(0)); // h
console.log(`value : ${text}, type : ${typeof text}`)
text = 1;
console.log(`value : ${text}, type : ${typeof text}`)
text = '7' + 5;
console.log(`value : ${text}, type : ${typeof text}`)
text = '8' / '2';
console.log(`value : ${text}, type : ${typeof text}`)
console.log(text.charAt(0)); //위에 문자로 연산을 하였지만 JS가 숫자로 연산을 해주고 타입도 숫자로 바뀌었기 때문에 index를 호출 할 수 없다