Object Methods interview questions
Practice 45 questions on object methods. Each runs in a real in-browser editor with Jest tests and a worked, diagram-backed solution.
45 questions
- JavaScriptCoding exercise
Data Merging
EASYImplement a function that consolidates rows sharing the same user into a single grouped record.
15 minCoinbase · Meta · OpenAI +3Practice - JavaScriptCoding exercise
From Pairs
EASYImplement a function that builds an object from an array of [key, value] pair tuples.
15 minPractice - JavaScriptCoding exercise
Function Length
EASYImplement a function that returns the number of declared parameters of a given function.
15 minPractice - JavaScriptCoding exercise
jQuery.css
EASYImplement a jQuery-style helper that gets or sets inline CSS properties on a DOM element.
15 minLinkedInPractice - JavaScriptCoding exercise
Key By
EASYImplement lodash keyBy — index a collection into an object keyed by an iteratee's return, keeping the last item for each key.
15 minPractice - JavaScriptCoding exercise
Object Map
EASYImplement a function that returns a new object with every value transformed by a mapper callback.
15 minPractice - JavaScriptCoding exercise
Object.entries
EASYImplement Object.entries — return an object's own enumerable string-keyed [key, value] pairs in insertion order.
15 minPractice - JavaScriptCoding exercise
Object.fromEntries
EASYImplement Object.fromEntries — build an object from any iterable of [key, value] pairs, with later keys winning.
15 minPractice - JavaScriptCoding exercise
Size
EASYImplement a function that returns the element count of any collection — array, string, object, Map, or Set.
15 minPractice - JavaScriptCoding exercise
Type Utilities
EASYImplement a set of helper functions that report the primitive type of any JavaScript value.
15 minPractice - JavaScriptCoding exercise
Camel Case Keys
MEDIUMImplement a function that returns a new object with every key converted to camelCase, recursing into nested objects.
25 minAirbnb · GooglePractice - JavaScriptCoding exercise
Class Variance Authority
MEDIUMImplement a simplified cva that builds class names from base styles, variant tables, and default values.
25 minPractice - JavaScriptCoding exercise
Compact II
MEDIUMImplement a function that returns a deep copy of an object with all falsy values stripped from nested structures.
25 minPremium questionPractice - JavaScriptCoding exercise
Conforms To
MEDIUMImplement a function that checks whether an object satisfies a source schema of predicate validators.
25 minPremium questionPractice - JavaScriptCoding exercise
Console Log History
MEDIUMImplement a wrapper that intercepts console.log calls and records their arguments for later inspection.
25 minMetaPractice - JavaScriptCoding exercise
Count By
MEDIUMImplement a function that tallies how many array elements map to each key produced by an iteratee.
25 minPractice - JavaScriptCoding exercise
Deep Clone
MEDIUMImplement a function that recursively clones a JSON-serializable value without sharing references.
25 minAdobe · Amazon · ByteDance +4Practice - JavaScriptCoding exercise
Deep Merge
MEDIUMImplement a function that recursively merges two objects, combining nested properties rather than overwriting them.
25 minPractice - JavaScriptCoding exercise
Deep Omit
MEDIUMImplement a function that returns a copy of a value with the given keys stripped from every nested object.
25 minGooglePractice - JavaScriptCoding exercise
Event Emitter
MEDIUMImplement an EventEmitter class supporting on, off, and emit to register and trigger listeners.
25 minAirbnb · ByteDance · Canva +13Practice - JavaScriptCoding exercise
Event Emitter II
MEDIUMImplement an event emitter where subscribe returns a handle whose release method removes that listener.
25 minAirbnb · ByteDance · Google +7Practice - JavaScriptCoding exercise
Get
MEDIUMImplement a function that safely reads a nested object path and returns a default when any segment is missing.
25 minAmazon · ByteDance · TikTokPractice - JavaScriptCoding exercise
get / set
MEDIUMImplement get and set — read and write a nested value by a path like 'a.b[0].c', creating missing containers on set.
25 minPremium questionPractice - JavaScriptCoding exercise
Group By
MEDIUMImplement a function that buckets array elements into an object keyed by the value an iteratee returns for each.
25 minLinkedIn · ThoughtspotPractice - JavaScriptCoding exercise
instanceof
MEDIUMImplement an instanceof check — walk the prototype chain to see whether a constructor's prototype appears in it.
40 minPremium questionPractice - JavaScriptCoding exercise
invert
MEDIUMImplement invert and invertBy — swap an object's keys and values, grouping collisions with invertBy.
25 minPremium questionPractice - JavaScriptCoding exercise
Is Empty
MEDIUMImplement a function that decides whether a value is empty across arrays, strings, objects, Maps, Sets, and primitives.
20 minPremium questionPractice - JavaScriptCoding exercise
jQuery Class Manipulation
MEDIUMImplement chainable addClass, removeClass, toggleClass, and hasClass helpers on a DOM element wrapper.
25 minPractice - JavaScriptCoding exercise
localStorage With Expiry
MEDIUMImplement a localStorage wrapper that stores values with a TTL and returns null once an entry has expired.
25 minAnthropic · ByteDance · Coinbase +2Practice - JavaScriptCoding exercise
mapKeys / mapValues
MEDIUMImplement mapKeys and mapValues — transform an object's keys or values while preserving its structure.
25 minPremium questionPractice - JavaScriptCoding exercise
Mini Object-relational Mapper
MEDIUMBuild a simplified in-memory ORM with model delegates that expose basic CRUD operations.
25 minOpenAIPractice - JavaScriptCoding exercise
Object.assign
MEDIUMImplement Object.assign — copy own enumerable string and symbol properties from sources onto a target, skipping nullish.
25 minPremium questionPractice - JavaScriptCoding exercise
Object.create
MEDIUMImplement Object.create — make a new object with a given prototype and optional property descriptors.
40 minPremium questionPractice - JavaScriptCoding exercise
pick / omit
MEDIUMImplement pick, omit, pickBy, and omitBy — build a subset of an object by a key list or by a predicate.
25 minPremium questionPractice - JavaScriptCoding exercise
Squash Object
MEDIUMImplement a function that flattens a nested object into a single-level object using dot-delimited keys.
25 minPractice - JavaScriptCoding exercise
Test Runner
MEDIUMImplement a minimal test runner that registers cases, runs each one, and reports pass and fail counts.
25 minMetaPractice - JavaScriptCoding exercise
Turtle
MEDIUMBuild a Turtle class that tracks position and heading as you issue movement and turn commands on a 2D plane.
25 minPractice - JavaScriptCoding exercise
Type Utilities II
MEDIUMImplement helpers that accurately identify non-primitive JavaScript values such as arrays, plain objects, dates, and maps.
25 minPremium questionPractice - JavaScriptCoding exercise
Unsquash Object
MEDIUMImplement a function that rebuilds a nested object from a flat map of dot-delimited keys.
25 minPractice - JavaScriptCoding exercise
Backbone Model
HARDImplement a Backbone-style Model class that stores attributes and emits change events per key.
40 minAirbnbPractice - JavaScriptCoding exercise
Deep Clone II
HARDImplement a deep clone that copies nested values and correctly handles circular references using a visited map.
40 minByteDance · TikTokPractice - JavaScriptCoding exercise
Deep Equal
HARDImplement a function that determines whether two values are structurally equal across nested objects and arrays.
40 minGooglePractice - JavaScriptCoding exercise
Mini Object-relational Mapper III
HARDBuild a simplified in-memory ORM with field selection and eagerly included related records.
40 minPremium questionOpenAIPractice - JavaScriptCoding exercise
structuredClone
HARDImplement structuredClone — deep-clone a value including Map, Set, Date, RegExp, typed arrays, and circular references.
40 minPremium questionPractice - JavaScriptCoding exercise
Styled Text Ranges IV
HARDImplement a function that patches shallow style objects over a text range without clobbering unrelated keys.
40 minPremium questionFigmaPractice