๐ฆ
Omit Keys
Omit Keys๋ณดํต ๊ฐ์ฒด +20pts
Problem
Write a function that returns an object without the specified keys.
Examples
Input:
omit({a: 1, b: 2, c: 3}, ["b"])Output:
{a: 1, c: 3}Explanation
์ด ๋ฌธ์ ๋ **Object.entries()์ Object.fromEntries()**๋ฅผ ์กฐํฉํ์ฌ ๊ฐ์ฒด์์ ํน์ ํค๋ฅผ ์ ์ธํ๋ ๋ฐฉ๋ฒ์ ํ์ตํฉ๋๋ค. ## ํต์ฌ ๊ฐ๋ : ๊ฐ์ฒด ๋ณํ ํ์ดํ๋ผ์ธ ๊ฐ์ฒด๋ฅผ ๋ฐฐ์ด๋ก ๋ณํ โ ํํฐ๋ง โ ๋ค์ ๊ฐ์ฒด๋ก ๋ณํํ๋ ํจํด์ ๋๋ค. ### ์ ๊ทผ ๋ฐฉ๋ฒ ```javascript Object.fromEntries( Object.entries(obj).filter(([k]) => !keys.includes(k)) ) ``` ### ๋จ๊ณ๋ณ ๋ถ์ 1. Object.entries(obj): ๊ฐ์ฒด๋ฅผ [ํค, ๊ฐ] ๋ฐฐ...
View detailed explanation โKey Concepts
Object.entries Object.fromEntries filter ๊ฐ์ฒด ๋ณํ
Time: O(n*m) Space: O(n)
solution.js
Ctrl + Enter
Run tests to see results here.