[Array - VanillaJS] 배열 만들어보기
class myArray { constructor() { this.length = 0; this.data = {}; } get(index) { return this.data[index] } push(item) { this.data[this.length] = item; this.length++; } pop() { const data = this.data[this.length-1]; delete this.data[this.length-1]; this.length--; return data; } delete(index) { const item = this.data[index]; this.shiftItems(index); } shiftItems(index) { for (let i=index; i
2020.05.21