str
replace(arg1, arg2), chatAt(index), endsWith(), startsWith() includes(), indexOf(), toLowerCase(), toUpperCase()
array
- endsWith(), startsWith(), includes(), indexOf()
- splice() 배열 원소 삭제할 때!
isNaN()
sort() 이용해서 객체나 정수 배열 내림, 오름차순 만들기
// 배열에 담긴 상품(객체)의 가격 중 큰 것을 limit만큼 출력
function biggerPrice(limit, data) {
const answer = [];
data.sort(function(a, b){
return b.price - a.price;
})
for(let i =0; i<limit; i++){
answer.push(data[i]);
}
return answer;
}
'프로그래밍 > JavaScript' 카테고리의 다른 글
19.12.10) JS - 노마드코더 강의 실습 복습 (0) | 2019.12.14 |
---|---|
19.12.09) JS - ES6 속 추가된 문법 (0) | 2019.12.14 |
19.11.23) Javascript - 배열의 메소드 (0) | 2019.12.13 |
19.11.22) Javascript - 객체 (0) | 2019.12.13 |
19.11.21) Javascript - 함수 (0) | 2019.12.13 |