Summer Sale! Additional 20% off annual and lifetime plans with the code SUMMERSALE23. Grab your discount today!

JavaScript and TypeScript Questions

150+ JavaScript and TypeScript interview questions, from implementing common library APIs, utility functions, algorithms, to building UI components and more.

Questions List

  • CounterWarm Up Question

    Build a simple counter that increments whenever a button is clicked
    Difficulty
    Easy
    Available Frameworks
    Users Completed
    3341 completed
  • StackFree

    Implement a stack data structure containing the common stack methods
    Difficulty
    Easy
    Languages
    JSTS
    Users Completed
    1066 completed
  • Type UtilitiesFree

    Implement utilities to determine primitive variable types in JavaScript
    Difficulty
    Easy
    Languages
    JSTS
    Users Completed
    968 completed
  • Insertion SortFree

    Implement a function that performs an insertion sort
    Difficulty
    Easy
    Languages
    JSTS
    Users Completed
    447 completed
  • Type Utilities IIFree

    Implement utilities to determine non-primitive variable types in JavaScript
    Difficulty
    Easy
    Languages
    JSTS
    Users Completed
    427 completed
  • Mortgage CalculatorFree

    Build a calculator that computes the monthly mortgage for a loan
    Difficulty
    Easy
    Available Frameworks
    Users Completed
    96 completed
  • Binary SearchFree

    Implement a function that performs binary search on an array of numbers
    Difficulty
    Medium
    Languages
    JSTS
    Users Completed
    457 completed
  • Breadth-First SearchFree

    Implement a breadth-first search algorithm that traverses a directed graph in a breadth-first manner
    Difficulty
    Medium
    Languages
    JSTS
    Users Completed
    97 completed
  • DebounceFree

    Implement a function to limit how many times a function can be executed by delaying the execution of the function until after a specified time after its last execution attempt
    Difficulty
    Medium
    Languages
    JSTS
    Users Completed
    1131 completed
  • Depth-First SearchFree

    Implement a depth-first search algorithm that traverses a directed graph in a depth-first manner
    Difficulty
    Medium
    Languages
    JSTS
    Users Completed
    195 completed
  • Heap SortFree

    Implement a function that performs a heap sort
    Difficulty
    Medium
    Languages
    JSTS
    Users Completed
    62 completed
  • QueueFree

    Implement a queue data structure containing the common queue methods
    Difficulty
    Medium
    Languages
    JSTS
    Users Completed
    250 completed
  • TabsFree

    Build a tabs component that displays a list of tab elements and one associated panel of content at a time
    Difficulty
    Medium
    Available Frameworks
    Users Completed
    312 completed
  • FlattenFree

    Implement a function that recursively flattens an array into a single level deep
    Difficulty
    Medium
    Languages
    JSTS
    Users Completed
    1495 completed
  • Merge SortFree

    Implement a function that performs a recursive merge sort
    Difficulty
    Medium
    Languages
    JSTS
    Users Completed
    111 completed
  • Promise.allFree

    Implement the Promise.all() function that resolves to an array of results if all the input elements are resolved or rejects otherwise
    Difficulty
    Medium
    Languages
    JSTS
    Users Completed
    786 completed
  • Quick SortFree

    Implement a function that performs a recursive quick sort
    Difficulty
    Medium
    Languages
    JSTS
    Users Completed
    89 completed
  • Todo ListFree

    Build a Todo list that lets users add new tasks and delete existing tasks
    Difficulty
    Medium
    Available Frameworks
    Users Completed
    901 completed
  • Topological SortFree

    Implement a function that performs a topological sort
    Difficulty
    Medium
    Languages
    JSTS
    Users Completed
    33 completed
  • Traffic LightFree

    Build a traffic light where the lights switch from green to yellow to red after predetermined intervals and loop indefinitely
    Difficulty
    Medium
    Available Frameworks
    Users Completed
    157 completed
  • Deep CloneFree

    Implement a function that performs a deep copy of a value
    Difficulty
    Medium
    Languages
    JSTS
    Users Completed
    479 completed
  • Digital ClockFree

    Build a 7-segment digital clock that shows the current time
    Difficulty
    Medium
    Available Frameworks
    Users Completed
    127 completed
  • New

    Job BoardFree

    Build a job board that displays the latest job postings from Hacker News
    Difficulty
    Medium
    Available Frameworks
    Users Completed
    18 completed
  • New

    ClampPremium

    Implement a function to clamp a number within the inclusive lower and upper bounds
    Difficulty
    Easy
    Languages
    JSTS
    Users Completed
    158 completed
  • Array.prototype.squarePremium

    Implement a custom Array.prototype.square() method that squares the values in an array
    Difficulty
    Easy
    Languages
    JSTS
    Users Completed
    1127 completed
  • New

    ChunkPremium

    Implement a function that creates an array of elements split into smaller groups of a specified size
    Difficulty
    Easy
    Languages
    JSTS
    Users Completed
    212 completed
  • New

    CompactPremium

    Implement a function that creates an array with all falsey values removed
    Difficulty
    Easy
    Languages
    JSTS
    Users Completed
    187 completed
  • New

    DifferencePremium

    Implement a function that finds the difference in values between arrays
    Difficulty
    Easy
    Languages
    JSTS
    Users Completed
    124 completed
  • New

    Drop Right WhilePremium

    Implement a function that excludes elements from the end of an array until the predicate returns false
    Difficulty
    Easy
    Languages
    JSTS
    Users Completed
    107 completed
  • New

    Drop WhilePremium

    Implement a function that excludes elements from the beginning of an array until the predicate returns false
    Difficulty
    Easy
    Languages
    JSTS
    Users Completed
    96 completed
  • New

    FillPremium

    Implement a function that fills an array with values within specified indices
    Difficulty
    Easy
    Languages
    JSTS
    Users Completed
    72 completed
  • New

    Find IndexPremium

    Implement a function that returns the index of the first element in the array that satisfies the provided testing function
    Difficulty
    Easy
    Languages
    JSTS
    Users Completed
    58 completed
  • New

    Find Last IndexPremium

    Implement a function that returns the index of the last element in the array that satisfies the provided testing function
    Difficulty
    Easy
    Languages
    JSTS
    Users Completed
    43 completed
  • GetPremium

    Implement a function to safely access deeply-nested properties in JavaScript objects
    Difficulty
    Easy
    Languages
    JSTS
    Users Completed
    763 completed
  • New

    In RangePremium

    Implement a function to check if a number falls between two numbers
    Difficulty
    Easy
    Languages
    JSTS
    Users Completed
    58 completed
  • OncePremium

    Implement a function that accepts a callback and restricts its invocation to at most once
    Difficulty
    Easy
    Languages
    JSTS
    Users Completed
    554 completed
  • Selection SortPremium

    Implement a function that performs a selection sort
    Difficulty
    Easy
    Languages
    JSTS
    Users Completed
    373 completed
  • Unique ArrayPremium

    Implement a function to remove all duplicate values from an array
    Difficulty
    Easy
    Languages
    JSTS
    Users Completed
    670 completed
  • AccordionPremium

    Build an accordion component that a displays a list of vertically stacked sections with each containing a title and content snippet
    Difficulty
    Easy
    Available Frameworks
    Users Completed
    422 completed
  • Array.prototype.filterPremium

    Implement the Array.prototype.filter() method
    Difficulty
    Easy
    Languages
    JSTS
    Users Completed
    763 completed
  • Array.prototype.mapPremium

    Implement the Array.prototype.map() method
    Difficulty
    Easy
    Languages
    JSTS
    Users Completed
    851 completed
  • Array.prototype.reducePremium

    Implement the Array.prototype.reduce() method
    Difficulty
    Easy
    Languages
    JSTS
    Users Completed
    481 completed
  • New

    Flight BookerPremium

    Build a component that books a flight for specified dates
    Difficulty
    Easy
    Available Frameworks
    Users Completed
    82 completed
  • Function.prototype.bindPremium

    Implement the Function.prototype.bind() function that creates a new function with the `this` keyword set to a provided value
    Difficulty
    Easy
    Languages
    JSTS
    Users Completed
    454 completed
  • Generate TablePremium

    Generate a table of numbers given the rows and columns
    Difficulty
    Easy
    Available Frameworks
    Users Completed
    231 completed
  • jQuery.cssPremium

    Implement a jQuery-like function that sets the style of a DOM element
    Difficulty
    Easy
    Languages
    HTMLCSSJSTS
    Users Completed
    377 completed
  • Progress BarPremium

    Build a progress bar component that shows the percentage completion of an operation
    Difficulty
    Easy
    Available Frameworks
    Users Completed
    406 completed
  • Progress BarsPremium

    Build a list of progress bars that fill up gradually when they are added to the page
    Difficulty
    Easy
    Available Frameworks
    Users Completed
    205 completed
  • Promise.racePremium

    Implement the Promise.race() function that resolves or rejects when any of the input elements are resolved or rejected
    Difficulty
    Easy
    Languages
    JSTS
    Users Completed
    308 completed
  • SumPremium

    Implement a function that sums numbers by accepting a number and allows for repeated calling with more numbers until it is not called with any number
    Difficulty
    Easy
    Languages
    JSTS
    Users Completed
    378 completed
  • Temperature ConverterPremium

    Build a temperature converter widget that converts temperature values between Celsius and Fahrenheit
    Difficulty
    Easy
    Available Frameworks
    Users Completed
    332 completed
  • CurryPremium

    Implement a function that transforms a function that takes multiple arguments into a function that can be repeatedly called with only one argument at a time
    Difficulty
    Medium
    Languages
    JSTS
    Users Completed
    682 completed
  • New

    Is EmptyPremium

    Implement a function to check if a value is an empty object, collection, map, or set
    Difficulty
    Medium
    Languages
    JSTS
    Users Completed
    26 completed
  • LimitPremium

    Implement a function that accepts a callback and restricts its invocation to at most N times
    Difficulty
    Medium
    Languages
    JSTS
    Users Completed
    246 completed
  • ThrottlePremium

    Implement a function to control the execution of a function by limiting how many times it can execute over time
    Difficulty
    Medium
    Languages
    JSTS
    Users Completed
    454 completed
  • Accordion IIPremium

    Build an accessible accordion component that has the right ARIA roles, states, and properties
    Difficulty
    Medium
    Available Frameworks
    Users Completed
    80 completed
  • Accordion IIIPremium

    Build a fully accessible accordion component that has keyboard support according to ARIA specifications
    Difficulty
    Medium
    Available Frameworks
    Users Completed
    40 completed
  • Analog ClockPremium

    Build an analog clock where the hands update and move like a real clock
    Difficulty
    Medium
    Available Frameworks
    Users Completed
    67 completed
  • Camel Case KeysPremium

    Implement a function to convert all the keys in an object to camel case
    Difficulty
    Medium
    Languages
    JSTS
    Users Completed
    188 completed
  • ClassnamesPremium

    Implement a function that conditionally joins CSS class names together
    Difficulty
    Medium
    Languages
    CSSJSTS
    Users Completed
    310 completed
  • Curry IIPremium

    Implement a function that transforms a function that takes multiple arguments into a function that can be repeatedly called with any number of arguments
    Difficulty
    Medium
    Languages
    JSTS
    Users Completed
    203 completed
  • Debounce IIPremium

    Implement a debounce function that comes with a cancel method to cancel delayed invocations and a flush method to immediately invoke them
    Difficulty
    Medium
    Languages
    JSTS
    Users Completed
    147 completed
  • Event EmitterPremium

    Implement a class that can subscribe to and emit events that trigger attached callback functions
    Difficulty
    Medium
    Languages
    JSTS
    Users Completed
    151 completed
  • Event Emitter IIPremium

    Implement a class that can subscribe to and emit events that trigger attached callback functions. Subscription objects are returned and can unsubscribe itself
    Difficulty
    Medium
    Languages
    JSTS
    Users Completed
    98 completed
  • getElementsByTagNamePremium

    Implement a function to get all DOM elements that match a tag
    Difficulty
    Medium
    Languages
    HTMLJSTS
    Users Completed
    261 completed
  • Grid LightsPremium

    Build a grid of lights where the lights deactivate in the reverse order they were activated
    Difficulty
    Medium
    Available Frameworks
    Users Completed
    86 completed
  • HTML SerializerPremium

    Implement a function to serialize an object into a HTML string with indentation
    Difficulty
    Medium
    Languages
    HTMLJSTS
    Users Completed
    79 completed
  • Identical DOM TreesPremium

    Implement a function to determine if two DOM trees are the same
    Difficulty
    Medium
    Languages
    HTMLJSTS
    Users Completed
    151 completed
  • jQuery Class ManipulationPremium

    Implement a set of jQuery-like functions that manipulates classes on a DOM element
    Difficulty
    Medium
    Languages
    HTMLCSSJSTS
    Users Completed
    102 completed
  • Like ButtonPremium

    Build a Like button that changes appearance based on the states
    Difficulty
    Medium
    Available Frameworks
    Users Completed
    105 completed
  • List FormatPremium

    Implement a function that formats a list of items into a single readable string
    Difficulty
    Medium
    Languages
    JSTS
    Users Completed
    247 completed
  • Progress Bars IIPremium

    Build a list of progress bars that fill up gradually in sequence, one at a time
    Difficulty
    Medium
    Available Frameworks
    Users Completed
    57 completed
  • Promise.allSettledPremium

    Implement the Promise.allSettled() function that resolves to an array of outcomes when all the input elements are either resolved or rejected
    Difficulty
    Medium
    Languages
    JSTS
    Users Completed
    188 completed
  • Promise.anyPremium

    Implement the Promise.any() function that resolves when any of the input elements are resolved
    Difficulty
    Medium
    Languages
    JSTS
    Users Completed
    241 completed
  • Squash ObjectPremium

    Implement a function that returns a new object after squashing the input object into a single level of depth
    Difficulty
    Medium
    Languages
    JSTS
    Users Completed
    145 completed
  • Star RatingPremium

    Build a star rating component that shows a row of star icons for users to select the number of filled stars corresponding to the rating
    Difficulty
    Medium
    Available Frameworks
    Users Completed
    270 completed
  • Tabs IIPremium

    Build a semi-accessible tabs component that has the right ARIA roles, states, and properties
    Difficulty
    Medium
    Available Frameworks
    Users Completed
    34 completed
  • Tabs IIIPremium

    Build a fully accessible tabs component that has keyboard support according to ARIA specifications
    Difficulty
    Medium
    Available Frameworks
    Users Completed
    24 completed
  • Text SearchPremium

    Implement a function to highlight text if a searched term appears within it
    Difficulty
    Medium
    Languages
    HTMLJSTS
    Users Completed
    185 completed
  • Deep EqualPremium

    Implement a function that determines if two values are equal
    Difficulty
    Medium
    Languages
    JSTS
    Users Completed
    211 completed
  • getElementsByClassNamePremium

    Implement a function to get all DOM elements that contain the specified classes
    Difficulty
    Medium
    Languages
    HTMLCSSJSTS
    Users Completed
    125 completed
  • Progress Bars IIIPremium

    Build a list of progress bars that fill up gradually concurrently, up to a limit of 3
    Difficulty
    Medium
    Available Frameworks
    Users Completed
    34 completed
  • Text Search IIPremium

    Implement a function to highlight text if searched terms appear within it
    Difficulty
    Medium
    Languages
    HTMLJSTS
    Users Completed
    46 completed
  • New

    Tic-tac-toePremium

    Build a tic-tac-toe game that is playable by two players
    Difficulty
    Medium
    Available Frameworks
    Users Completed
    9 completed
  • Signup FormPremium

    Build a signup form that does validation on user details and submits to a back end API
    Difficulty
    Medium
    Available Frameworks
    Users Completed
    110 completed
  • StopwatchPremium

    Build a stopwatch widget that can measure how much time has passed
    Difficulty
    Medium
    Available Frameworks
    Users Completed
    52 completed
  • New

    Transfer ListPremium

    Build a component that allows transferring of items between two lists
    Difficulty
    Medium
    Available Frameworks
    Users Completed
    11 completed
  • Undoable CounterPremium

    Build a counter with a history of the values and ability to undo/redo actions
    Difficulty
    Medium
    Available Frameworks
    Users Completed
    21 completed
  • New

    whack-a-molePremium

    Build a popular arcade game where players attempt to hit moles as they pop up from holes in a board
    Difficulty
    Medium
    Available Frameworks
  • New

    Memory GamePremium

    Build a memory game where the player needs to match pairs of cards
    Difficulty
    Medium
    Available Frameworks
    Users Completed
    4 completed
  • Curry IIIPremium

    Implement a function which transforms a function which takes variadic arguments into a function that can be repeatedly called with any number of arguments
    Difficulty
    Hard
    Languages
    JSTS
    Users Completed
    45 completed
  • Progress Bars IVPremium

    Build a list of progress bars that fill up gradually concurrently, up to a limit of 3 and allows for pausing and resuming
    Difficulty
    Hard
    Available Frameworks
    Users Completed
    23 completed
  • Data SelectionPremium

    Implement a function to filter rows of data matching a specified requirement
    Difficulty
    Hard
    Languages
    JSTS
    Users Completed
    77 completed
  • Table of ContentsPremium

    Implement a function to construct a table of contents from a HTML document
    Difficulty
    Hard
    Languages
    HTMLJSTS
    Users Completed
    44 completed
  • Deep Clone IIPremium

    Implement a function that performs a deep copy of a value, but also handles circular references
    Difficulty
    Hard
    Languages
    JSTS
    Users Completed
    41 completed
  • New

    Tic-tac-toe IIPremium

    Build an N x N tic-tac-toe game that requires M consecutive marks to win
    Difficulty
    Hard
    Available Frameworks
    Users Completed
    1 completed
  • New

    Transfer List IIPremium

    Build a component that allows transferring of items between two lists, bulk selection/unselection of items, and adding of new items
    Difficulty
    Hard
    Available Frameworks
    Users Completed
    3 completed
  • JSON.stringifyPremium

    Implement a function that converts a JavaScript value into a JSON string
    Difficulty
    Hard
    Languages
    JSTS
    Users Completed
    42 completed
  • New

    WordlePremium

    Build Wordle, the word-guessing game that took the world by storm
    Difficulty
    Hard
    Available Frameworks
    Users Completed
    1 completed
Logos provided by Clearbit