Wisdom_1104 2023. 1. 1. 20:10

- typeof -

string(문자)인지 number(숫자)인지 알려줌.

 

 

- parseInt -

string을 number로 변환, 변환이 안될 시 NaN

 

- prompt -

알림창에 질문창을 만듬.

 

 

예제 코드)

const age = prompt ("How old are you?");
console.log (typeof age);

15 => number

ori => string

 

 

const age = prompt ("How old are you?");
console.log (age, parseInt(age));

15 => 15   15

ori => ori    NaN

 

*NaN = Not a number