home
자바
home
😳

창피

부끄러워하지마!!!
let words:[{ word: string, mean: string }] class Dict { constructor ( private word:string, private mean:string, ) {} add() { words.forEach(item => { if (this.word === item.word) { return; } }) words.push({'word': this.word, 'mean':this.mean}) console.log(words) } get() { return words.filter(item => item.word === this.word).map(item => item.mean) } delete() { words.filter(item => item.word === this.word).map(item => delete item.word); } update() { this.delete(); this.add(); } showAll() { return words.filter(item => item.word).map(item => item.word) } count() { return words.length } }
TypeScript
복사