✅ 자바스크립트에서는 여러 종류의 데이터 타입들이 존재한다. 기본(원시형, primitive) 타입이라고 불리는 number, string, boolean, null, undefined이 있다.
프로그래밍 : 수많은 데이터를 <입력 ⇒ 처리 ⇒ 출력>하는 과정을 컴퓨터가 알아들을 수 있는 언어로 서술하는 것.
세상에는 무수히 많은 데이터들이 존재하고 이러한 데이터들을 컴퓨터가 보다 빠르고 효율적으로 처리하기 위해 자바스크립트라는 프로그래밍 언어가 구분해놓은 것이다.
1️⃣ 숫자 (Number) : 숫자 데이터(나이, 거리, 무게, 가격 등)
console.log(10) // 10을 출력
let age = 37
console.log(age) // 37을 출력
const myAge = 37
const yourAge = 25
console.log(myAge) // 37을 출력
console.log(yourAge) // 25를 출력
2️⃣ 문자열 (String) : 문자를 이중 따옴표("")나 작은따옴표('')로 데이터를 감싸야 한다.
let name = 'hyunjin'
console.log(name) // hyunjin을 출력
const firstName = 'hyunjin'
const lastName = 'lee'
console.log(firstName) // hyunjin을 출력
console.log(lastName) // lee을 출력
3️⃣ Boolean(불린) : 참과 거짓을 나타내는 true / false를 표현하는 데이터(비교연산자에서 많이 활용)
let isMan = true
let isWoman = false
console.log(isMan) // true을 출력
console.log(isWoman) // false을 출력
4️⃣ null : null은 텅텅 비어 있는 값을 의미
let name = null
console.log(name) // null을 출력
5️⃣ undefined : undefined은 변수를 선언만 하고 값이 할당되어 있지 않은 것
let age
console.log(age) // undefined를 출력
'Javascript' 카테고리의 다른 글
Hello World ✋ (0) | 2023.07.06 |
---|---|
프로그래밍 / 자바스크립트 / Node.js (0) | 2023.07.06 |
비교 / 논리 / 일치연산자 (0) | 2023.07.06 |
문자열 / 템플릿 리터럴 / 산술, 증감, 대입연산자 (0) | 2023.07.06 |
let과 const의 차이? (0) | 2023.07.06 |