let text = 'hello'; //type이 string이됨.
console.log(`value: ${text}, type: ${typeof text}`);
text = 1; //type이 number가 됨
console.log(`value: ${text}, type: ${typeof text}`);
//string '7'과 number 5를 더해버리면, 자바스크림트 엔진이 5를 string으로 변환해줌
text = '7' + 5;
console.log(`value: ${text}, type: ${typeof text}`);
//string과 string을 나누면 안에 숫자를 인식하고 number로 변환 나누어줌.
text = '8' / '2';
console.log(`value: ${text}, type: ${typeof text}`);
let text = 'hello';
console.log(text.charAt(0)); //첫번째 문자 보여줘
console.log(`value: ${text}, type: ${typeof text}`);
//string과 string을 나누면 안에 숫자를 인식하고 number로 변환 나누어줌.
text = '8' / '2';
console.log(`value: ${text}, type: ${typeof text}`);
console.log(text.charAt(0));
// 첫번째 문자 보여줘 안보여짐, number로 변경된상태;
다이나믹 타이핑 문제를 타입스크립트로 해결이 가능.
TS의 등장! 자바스크립트에 타입이 얹어진 언어이다.