## 1. 다음의 코드를 es6 문법을 이용하여 재작성 하시오 ```javascript= let name = "noona's fruit store" let fruits = ["banana","apple","mango"] let address = "Seoul" let store = {name, fruits, address} console.log(store); ``` 출력 결과 ![image](https://hackmd.io/_uploads/BytO3W4wR.png) <br><br><br> ## 2. es6 문법을 이용하여 다음과 같이 출력하시오 제 가게 이름은 noona's fruit store 입니다. 위치는 Seoul 에 있습니다 ```javascript= let result = `제 가게 이름은 ${store.name}입니다. 위치는 ${store.address}에 있습니다.`; ``` 출력 결과 ![image](https://hackmd.io/_uploads/r1WQTbNwC.png) <br><br><br> ## 3. 다음 코드를 Destructoring을 이용하여 해결하시오 ```javascript= function calculate(obj){ let {a, b, c} = obj return a + b + c; } console.log(calculate({a:1,b:2,c:3})); ``` 출력 결과 ![image](https://hackmd.io/_uploads/S1vQ1fEDA.png) <br><br><br> ## 4. 다음 문제에 정답이 true가 나오게 하시오 ```javascript= let name = "noona store" let fruits = ["banana","apple","mango"] let address = { country:"Korea", city:"Seoul" } function findStore(obj){ let {name, address:{city}} = obj; return name==="noona store" && city === "Seoul" } console.log(findStore({name,fruits,address})); ``` 출력 결과 ![image](https://hackmd.io/_uploads/SJSb8XBP0.png) <br> 중첩된 객체에서 프로퍼티 추출하기 ```javascript= const user = { name: 'Lee', address: { zipCode: '03068', city: 'Seoul' } }; // address 프로퍼티 키로 객체를 추출하고 이 객체의 city 프로퍼티 키로 값을 추출한다. // key값:{객체 내부 key값} const { address: { city } } = user; console.log(city); // 'Seoul' ``` <br><br><br> ## 5. 다음과같이 프린트되게 코드를 바꾸시오 ```javascript= function getNumber(){ let array = [1,2,3,4,5,6]; let [first, , third, fourth] = array; return {first,third,fourth}; } console.log(getNumber()) // 결과값 { first: 1, third: 3, forth: 4 } ``` 출력 결과 ![image](https://hackmd.io/_uploads/H1c4hXHvC.png) <br><br><br> ## 6. 다음의 결과가 true가 되게 하시오 ```javascript= function getCalendar(first, ...rest) { return ( first === "January" && rest[0] === "Febuary" && rest[1] === "March" && rest[2] === undefined ); } console.log(getCalendar("January","Febuary","March")); // let month = ["January", "Febuary", "March"]; // let [first,...rest] = month; // console.log(first); // "January" // console.log(rest); // ["Febuary", "March"] // console.log(rest[0]); // "Febuary" // console.log(rest[1]); // "March" // console.log(rest[2]); // undefined ``` 출력 결과 ![image](https://hackmd.io/_uploads/Hk6-x4SPA.png) <br><br><br> ## 7. 두 어레이들중 최소값을 찾는 함수를 완성하시오 ```javascript= function getMinimum(){ let a= [45,23,78]; let b = [54,11,9]; return Math.min(...a,...b) } console.log(getMinimum()); ``` 출력 결과 ![image](https://hackmd.io/_uploads/H1wqzNrwC.png) Math.min()함수와 Math.max()함수 - 두 함수들이 매개변수로 받는 값은 배열이 아닌 단순히 입력된 숫자이다. 즉, 고유한 변수를 기대한다. - 입력된 모든 값들은 숫자형으로 변환될 수 있는 타입이어야 한다. 그렇지 않으면 NaN을 반환하며, 매개변수를 생략하면 -Infinity를 반환한다. ```javascript= let arr = [1, 100, 40, 20, 5]; console.log(Math.min(arr)); // NaN, 배열은 숫자형으로 변환이 불가능하므로 NaN 반환 console.log(Math.min(...arr)); // 1 ``` <br><br><br> ## 8. 다음의 함수를 화살표 함수로 바꾸시오 ```javascript= function sumNumber() { const sum = (a, b) => a + b; return sum(40, 10); } console.log(sumNumber()); ``` 출력 결과 ![image](https://hackmd.io/_uploads/BkQQ8VHwA.png) <br><br><br> ## 9. 다음함수를 화살표 함수로 바꾸시오 ```javascript= function sumNumber() { let addNumber = (a) => (b) => (c) => a + b + c; return addNumber(1)(2)(3); /* function addNumber(a) { return function (b) { return function (c) { return a + b + c; }; }; } */ } console.log(sumNumber()); ``` 출력 결과 ![image](https://hackmd.io/_uploads/BkegG8Bv0.png)