
Spread / Rest Syntax // 구조분해 할당 (비구조화 할당) // example const [ a, b, ...rest ] = [1, 2, 3, 4, 5]; console.log(a); // 1 console.log(b); // 2 console.log(...rest); // 3 4 5 // for of문에서 구조분해 할당(비구조화 할당) 사용 // example const user = [ {name : 'kimcoding', age : 20, country : 'korea'}, {name : 'parkcoding', age : 24, country : 'america'}, {name : 'choicoding', age : 23, country : 'japan'} ]; // for of문 ..

Spread / Rest Syntax // 전개 연산자 // 주로 배열을 풀어서 인자로 전달하거나, 배열을 풀어서 각각의 요소로 넣을 때 사용합니다. // spread syntax는 원본배열을 변경하지 않습니다. (immutable) // 전개 연산자를 이용한 복사에는 1차원에서만 유효합니다. // 배열을 풀어서 인자로 전달 function sum(x, y, z) { return x + y + z; } const numbers = [1, 2, 3]; sum(...numbers); // 6 // 배열 합치기 const arr1 = [1, 2, 3]; const arr2 = [4, 5]; let arr3 = [...arr1, ...arr2]; console.log(arr1) // [1, 2, 3] conso..

객체 (Object) Data_type(Object_2)를 알아보는 시간이었습니다. 틀린 내용은 댓글로 알려주시면 감사하겠습니다.

객체 (Object) // Object // 객체는 중괄호로 객체를 선언합니다. // 객체는 키(key)와 값(value)의 쌍으로 이루어져 있습니다. // 객체의 요소는 쉼표(,)로 구분합니다. // 객체 안의 요소는 다양한 데이터 타입이 들어올 수 있습니다. let student = { name : 'kimcoding', age : 20, skills : ['HTML', 'CSS', 'JS'], sum : function (num1, num2) { return num1 + num2; } } // 데이터 호출 방법 console.log(student.name); // 'kimcoding' console.log(student[age]); // 20 console.log(student.sum(10, 20)..