Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | ||||
4 | 5 | 6 | 7 | 8 | 9 | 10 |
11 | 12 | 13 | 14 | 15 | 16 | 17 |
18 | 19 | 20 | 21 | 22 | 23 | 24 |
25 | 26 | 27 | 28 | 29 | 30 | 31 |
Tags
- npm styled-reset
- SCSS
- API token
- react env
- ngrok실행
- rewrites
- typescript react
- icon
- nextjs .env
- API 토큰
- nextjs
- github
- react typescript
- 컨디셔널 렌더링
- input type=file
- ngrok설치
- styled components
- next.js css
- getModifierState
- createGlobalStyle
- CSS
- react
- dart 변수
- fetch
- bootstrap
- Git
- nextjs 설치
- There isn’t anything to compare
- git lab
- github io
Archives
- Today
- Total
꾸준히 성장하는 개발자
data type 본문
boolean
true : 켜져있음
false : 꺼져있음
null : 비어있음
undefined
: variable이 메모리에 만들어졌지만 컴퓨터가 이 variable에 대해서 인지하고 있지만 값이 없는것
Arrays
: 데이터 타입을 그룹으로 묶어주는것
[ ] 대괄호를 사용한다.
하나의 variable 안에 데이터의 list를 가지는것
const daysOfWeek =[ "mon","tue","wed","thu","fri","sat"]
console.log(daysOfWeek); //['mon', 'tue', 'wed', 'thu', 'fri', 'sat']
daysOfWeek.push("sun");
console.log(daysOfWeek); //['mon', 'tue', 'wed', 'thu', 'fri', 'sat', 'sun']
Object
: property를 가진 데이터를 저장해준다.
{ } 중괄호를 사용한다.
여러 데이터를 key : value 형태로 저장한다.
const player ={
name:"abc",
points: 10,
color: false
}
console.log(player); //{name: 'abc', points: 10, color: false}
console.log(player.name); //abc
console.log(player["name"]); //abc
// console.log(player[points]); //오류 "" 사용할것
// Uncaught ReferenceError: points is not defined at app.js:20:21
player.color=true;
console.log(player); //{name: 'abc', points: 10, color: true}
player.lastname="potato";
console.log(player) //{name: 'abc', points: 10, color: true, lastname: 'potato'}
player.points = player.points+15;
console.log(player.points); //25
const 는 수정할수 없는 변수를 나타낸다.
하지만 여기에서 바뀐건 변수가 아닌 object안의 무언가를 수정한것
object 안의 무언가를 업데이트하는것 가능, 추가하는것 가능
에러가 나는것은 constant 전체를 하나의 값으로서 업데이트 하려고 할때 발생한다.
위에서 player.color = true; 가 아닌 player =true;로 작성하면 에러가 발생
= value를 할당
=== 같은지 확인
!== 같지 않음을 확인
'JavaScript' 카테고리의 다른 글
nvm설치 , node 설치 (feat . nvm 설치 중 겪은 에러) (0) | 2022.04.18 |
---|---|
[JavsScript] 생성자 함수 (0) | 2022.04.15 |
[JavaScript] 시계 만들기 (0) | 2022.02.28 |
물음표 연산자 , 삼항연산자 , 조건부 연산자 (0) | 2022.02.27 |
HTMLCollection - > Array로 바꾸기 (0) | 2022.02.23 |