01. 변수 : 데이터 저장
{
    // let x = 100;
    // let y = 200;
    // let z = "javascript";
    let x = 100, 
    y = 200, 
    z = "javascript";
    document.write(x)
    document.write(y)
    document.write(z)
    }   
    결과보기
02. 상수 : 데이터 불러오기
{
    const x = 100,
    y = 200,
    z = "javascript";
    document.write(x)
    document.write(y)
    document.write(z)
    }   
    결과보기
03. 배열 : 데이터 불러오기
{
    const arr = [100, 200, "javascript"];
    document.write(arr[0]);
    document.write(arr[1]);
    document.write(arr[2]);
    }   
    결과보기
04. 배열 : 데이터 불러오기 : 2차 배열
{
        const arr = [100, 200, ["javascript", "jquery"]];
        document.write(arr[0]);
        document.write(arr[1]);
        document.write(arr[2][0]);
        document.write(arr[2][1]);
        }
        결과보기
05. 배열 : 데이터 불러오기 : 갯수 구하기
{
    const arr = [100, 200, "javascript"];
    document.write(arr.length);
    }
    결과보기
06. 배열 : 데이터 불러오기 : for()문
    const arr = [100, 200, 300, 400, 500];
    // document.write(arr[0]);
    // document.write(arr[1]);
    // document.write(arr[2]);
    // document.write(arr[3]);
    // document.write(arr[4]);
    //for(초기값, 조건식, 증감식)
    for(let i=0; i -> arr.length; i++){
    document.write(arr[i]);
    }   
    결과보기
                                    100
200
300
400
500
                                
                            200
300
400
500
07. 배열 : 데이터 불러오기 : forEach()
const num = [100, 200, 300, 400, 500];
    //for문을 이용해서 출력...
    for(let i=0; i<num.length; i++) {
    document.write(num[i]);
    }
    //forEach()를 이용해서 출력
    num.forEach(function(element) {
    document.write(element);
    });
    //forEach() 3가지 인자(parameter)값
    num.forEach(function(element, index, array){
    document.write(element);
    document.write(index);
    document.write(array);
    });
    결과보기
                                100 
200
300
400
500
                                
100
200
300
400
500
                                
100
0
100,200,300,400,500
200
1
100,200,300,400,500
300
2
100,200,300,400,500
400
3
100,200,300,400,500
500
4
100,200,300,400,500
                        200
300
400
500
100
200
300
400
500
100
0
100,200,300,400,500
200
1
100,200,300,400,500
300
2
100,200,300,400,500
400
3
100,200,300,400,500
500
4
100,200,300,400,500
08. 배열 : 데이터 불러오기 : for of
{
    const arr = [100, 200, 300, 400, 500];
    for(let i of arr){
    document.write(arr[i]);
    }
    결과보기
10020030040050009. 배열 : 데이터 불러오기 : for in
{
    const arr = [100, 200, 300, 400, 500];
    for(let i in arr){
    //document.write(i);
    document.write(arr[i]);
    }
    결과보기
100200
300
400
500
10. 배열 : 데이터 불러오기 : for map
const arr = [100, 200, 300, 400, 500];
    //forEach 이용해서 값을 출력해주세요...
    arr.foreach(function(el) {
    document.write(el);
        
    });
    arr.foreach(function(el,i,array) {
    document.write(el);
    document.write(i);
    document.write(array);
    });
    결과보기
100200
300
400
500
0
1
2
3
4
5
100,200,300,400,500
100,200,300,400,500
100,200,300,400,500
100,200,300,400,500
100,200,300,400,500
11. 배열 : 데이터 불러오기 : 펼침연산자
document.write(...mun); 알고리즘 할때 많이 사용한다.
{
    const num = [100, 200, 300, 400, 500];
    document.write(num,"
")
    document.write(num[0],num[1],num[2],num[3],num[4],"
");
    document.write(...num);
    }
    결과보기
100,200,300,400,50012. 배열 : 데이터 불러오기 : 배열구조분해할당
{
    let a, b, c;
    [a,b,c] = [100, 200, "javascript"];
    document.write(a);
    document.write(b);
    document.write(c);
    }
    결과보기
100200javascript13. 객체 : 데이터 불러오기 : 기본
{
    const obj = {
    a : 100,
    b : 200,
    c : "javascript"
    }
    document.write(obj.a);
    document.write(obj.b);
    document.write(obj.c);
    }
    결과보기
100200javascript14. 객체 : 데이터 불러오기 : Object
{
    const obj = {
    a : 100,
    b : 200,
    c : "javascript"
    }
    document.write(Object.keys(obj));
    document.write(Object.values(obj));
    document.write(Object.entries(obj)); //두개다 불러옴
    }
    결과보기
a,b,c100,200,javascripta
a,100,b,200,c,javascript
15. 객체 : 데이터 불러오기 : 변수
{
    const obj = {
    a : 100,
    b : 200,
    c : "javascript"
    }
    const name1 = obj.a;
    const name2 = obj.b;
    const name3 = obj.c;
    document.write(name1);
    document.write(name2);
    document.write(name3);
    }
    결과보기
100200javascript100200javascript16. 객체 : 데이터 불러오기 : for in
(뷰에서 많이 씀,"key" 마음대로 정해도 됌)
{
    const obj = {
    a : 100,
    b : 200,
    c : "javascript"
    }
    for( let key in obj){
    document.write(obj[key]);
    }
    }
    결과보기
100200javascript17. 객체 : 데이터 불러오기 : map()
 {
    const obj = [
    {a:100, b:200, c:"javascript"}
    ];
    obj.map((el) => {
    document.write(el.a);
    document.write(el.b);
    document.write(el.c);
    });
    }
    결과보기
100200javascript18. 객체 : 데이터 불러오기 : hasOwnProperty()
안에 데이터가 있는지 없는지 true,false 알려줌
{
    const obj = {
    a : 100,
    b : 200,
    c : "javascript"
    }
    document.write(obj.hasOwnProperty("a"));
    document.write(obj.hasOwnProperty("b"));
    document.write(obj.hasOwnProperty("c"));
    document.write(obj.hasOwnProperty("d"));
    document.write("a" in obj);
    document.write("b" in obj);
    document.write("c" in obj);
    document.write("d" in obj);
    }
    결과보기
truetrue
true
false
true
true
true
false
19. 객체 : 데이터 불러오기 : 펼침연산자 - 복사
안에 데이터가 있는지 없는지 true,false 알려줌
{
    const obj = {
    a: 100,
    b: 200,
    c: "javascript"
}
const spread = { ...obj }
document.write(spread.a);
document.write(spread.b);
document.write(spread.c);
}
    결과보기
100200javascript20. 객체 : 데이터 불러오기 : 펼침연산자 - 추가
안에 데이터가 있는지 없는지 true,false 알려줌
 {
    const obj = {
    a: 100,
    b: 200,
    c: "javascript"
    }
    const spread = { ...obj, d: "jquery"}
    document.write(spread.a);
    document.write(spread.b);
    document.write(spread.c);
    document.write(spread.d);
}
    결과보기
100200javascriptjquery21. 객체 : 데이터 불러오기 : 펼침연산자 - 결합
{
    const objA = {
        a: 100,
        b: 200
    }
    const objB = {
        c : "javascript",
        b : "jquery"
    }
    const spread = { ...objA, ...objB }
    document.write(spread.a);
    document.write(spread.b);
    document.write(spread.c);
    document.write(spread.d);
}
    결과보기
100jqueryjavascriptundefined22. 객체 : 데이터 불러오기 : 비구조화 할당
안에 데이터가 있는지 없는지 true,false 알려줌
{
    const obj = {
        a: 100,
        b: 200,
        c: "javascript"
    }
    const { a, b, c } = obj;
    document.write(a);
    document.write(b);
    document.write(c);
}
    결과보기
100200javascript23. 객체 : 데이터 불러오기 : 객체구조분해할당
안에 데이터가 있는지 없는지 true,false 알려줌
//이름만 변경
{
    const obj = {
        a: 100,
        b: 200,
        c: "javascript"
    }
    const { a:name1, b:name2, c:name3} = obj;
    document.write(name1);
    document.write(name2);
    document.write(name3);
}