data

howyoujini·2021년 10월 29일
0

🤝 잡아 javascript

목록 보기
1/6

data type

(const와 let으로 변수 선언 가능)
(const는 재할당,재선언 둘다 불가/ let은 재할당 가능, 재선언 불가)

  • number 숫자
  • string 문자열
  • boolean
  • null : 선언되었음 그러나 텅빈
  • undefined : 선언되었음 정의되지 않음

2 and 2.2 are the "not" same data type.

data 정리하는 법 / 구조

  • array :
    순서가 있다. -> index 순서는 0번째부터 시작함.
  • object :

property를 불러오는 방법은 2가지가 있다.

  1. console.log(player.name); => tomato
  2. console.log(player["name"]); => tomato

data 반복하기 / 함수짜기

  • function(){}
  • 인자값이란?

1) if 문 : 참이면 바로 끝나버림. 순서 중요. 값은 if문에 따라 한번 출력
2)

** return : function이 function의 밖과 소통하는 방법 (도구)

console.log()

console.dir()

반복되는 문자열은 변수로 지정해주자
왜? 변수로 지정한 "string" (문자열)은 오타나도 vsc가 수정을 도와줌
그러나
반복되는 문자열 자체의 오타는 수정을 도와주지 않음

문자열과 변수명을 함께 지정할때
1) greeting.innerText = "Hello" + username;
2) greeting.innerText = ` Hello ${username} `; (백틱을 활용하기 !)

profile
어떡해 ? 어떻게 ! 업글중

0개의 댓글