유데미 - Datatypes

MK·2022년 5월 2일

Udemy 강의!

목록 보기
2/12
post-thumbnail

네 또 시작입니다!

Number : 숫자입니다.
String : 문자입니다.
Boolean : 참,거짓을 말합니다.
Undefined : 아직 정의 되지 않은 변수를 말합니다.
Null : 비어있는 value.
Symbol : 유니크한 value. 불변입니다!
Bigint : int가 가지고 있는 숫자들 보다 더 큰 숫자들을 가질 수 있습니다.

💪 자바스크립트는 dynamic typing이 있습니다.
변수에 있는 value마다 data type을 지정할 필요는 없습니다.
대신 자동으로 정의가 됩니다!

let javascriptIsFun = true;

console.log(javascriptIsFun);


true가 보라색 글자이니 true가 string이 아니라는 소리!
string이면 흰색이다.


console.log(typeof true);


console.log(typeof javascriptIsFun);


console.log(typeof 23);


console.log(typeof "jonas");


javascriptIsFun = "test!";


let javascriptIsFun = true;

console.log(typeof javascriptIsFun);


year 라는 변수 명을 준다음 datatype을 보니 undefined가 나왔다.
이렇게 빈 변수를 지정해 준다면 자동으로 undefined가 된다.
그냥 비어있다는 뜻이다.

let year;
console.log(year);
console.log(typeof year);


그래서 우리는 변수에 숫자를 집어 넣어보자.

year = 1991;
console.log(typeof year);
console.log(typeof null);

짜잔 변수의 Data Type이 나왔습니다.

마지막 null은 그냥 아무것도 아닌거다 라고 추가적으로 넣어본것 입니다.


😍 과제!

  1. Declare a variable called 'isIsland' and set its value according to your
    country. The variable should hold a Boolean value. Also declare a variable
    'language', but don't assign it any value yet
  2. Log the types of 'isIsland', 'population', 'country' and 'language'
    to the console

음... 영어를 잘 이해하지 못했다.
뭔소리지 이렇게 하라는거 맞나?

let isIsland = true;
let population = 500;
let country = "SouthKorea";
let language;

console.log(typeof isIsland);
console.log(typeof population);
console.log(typeof country);
console.log(typeof language);

그럼 시마이!

profile
그라타타타

0개의 댓글