★작업 전, 레이아웃을 어떻게 나눠서 진행 할 것인지 정하고 시작하기
1. 변수: 값을 담아내는 Box
2. 자료형
1) List
let a=['감자','사과','딸기']
a.push=('고구마')
2) dictionary
let b={'name':'영희', 'height':'150cm'}
b['age']=27
★List와 Dictonary는 조합하여 사용 가능.
ex1) list를 dict에 넣기
let a=['감자','사과','딸기']
b_dict=a_list
ex2) dict에 list를 넣기
let a={'name':'영희','age':27}
b_list.push=a_dict
3.함수형
function a(num1,num2){
return num1+num2
}
let b=a(1,2)
->b는 3
조건문(if)
반복문(for)
★dict, list, if, for를 다채롭게 섞어서 이용 할 수 있음
let a=[ //list
{'name':'영희', 'score':'90'}, //dict
{'name':'철수', 'score':'60'}
]
for(i=0 ; i<a.length ; i++){
if(a[i]['score']<80){
console.log(a[i]['name']) // 점수가 80점 이하인 철수의 이름이 출력 됨
}
}