Web/JavaScript

#2 - 자료형

J2Hong2 2022. 2. 14. 19:11

#2 - 자료형

문자형표현

const name = "MIKE";
const age = 30;

const message = `My name is ${name}`;
console.log(message)
// 1번 옆 ` (백쿼트 option + ₩), ' , " = 문자열 String
const message2 = `난 ${age}  입니다.`
console.log(message2)

숫자형 표현- 산술 연산자 (사칙연산 파이썬이랑 비슷)

console.log(6/3) // 나누기
console.log(6%4) // % 나머지
  • NAN = Not a Number

Boolean

  • True / False

Null 과 Undefined

  • 존재하지 않는다, 값이 할당되지 않았다. (객체형과 심볼형)

typeof 연산자

  • 변수의 자료형을 알 수 있음.