JavaScriptReactAngularVueSvelteCSSHTMLTypeScript

JavaScript 面试问题

470+ 个最重要的 JavaScript 面试问题,从库 API 和实用函数到算法和 UI 组件。
由前面试官解答
测试用例
在浏览器中编码

题目列表

JavaScript 面试指南探索我们的入门指南,在开始练习之前先全面了解 JavaScript 面试准备。
0/5 指南
指南
  • Counter热身问题Build a simple counter that increments whenever a button is clicked
    可用的框架
  • Make CounterImplement a function that accepts an integer value and returns a function that can be repeatedly called to return increasing values
    语言
  • MeanImplement a function that finds the mean of the values inside an array
    语言
  • Function.prototype.callImplement the Function.prototype.call() function that calls the function with a given `this` value and provided arguments
    语言
  • Min ByImplement a function that finds the minimum element based on the specified criteria
    语言
  • Selection SortImplement a function that performs a selection sort
    语言
  • StackImplement a stack data structure containing the common stack methods
    语言
  • Type UtilitiesImplement utilities to determine primitive variable types in JavaScript
    语言
  • useBooleanImplement a hook that manages a boolean state, with additional convenience utility methods
    语言
  • useCounterImplement a hook that manages a counter state, with some additional convenience utility methods
    语言
  • AccordionBuild an accordion component that a displays a list of vertically stacked sections with each containing a title and content snippet
    可用的框架
  • Array.prototype.reduceImplement the Array.prototype.reduce() method
    语言
  • Count Set Bits in a Binary NumberImplement a function to find set bits in binary representation of a given integer
    语言
  • CycleImplement a function that takes one or more values and returns a function that cycles through those values each time it is called
    语言
  • Find Duplicates in ArrayImplement a function to check if there are any duplicate numbers in the array
    语言
  • Find Missing Number in SequenceImplement a function to find the missing element in a sorted array
    语言
  • Insertion SortImplement a function that performs an insertion sort
    语言
  • Optimal Stock TradingImplement a function to find the maximum profit achievable by buying and selling a stock once
    语言
  • Pair sumImplement a function to find two numbers within an array of integers that add up to a target integer
    语言
  • Progress BarsBuild a list of progress bars that fill up gradually when they are added to the page
    可用的框架
  • String AnagramImplement a function to determine if two strings are anagram of each other
    语言
  • Type Utilities IIImplement utilities to determine non-primitive variable types in JavaScript
    语言
  • useClickAnywhereImplement a hook that handles click events anywhere on the document
    语言
  • useCounter IIImplement an optimized version of the useCounter hook
    语言
  • useCycleImplement a hook that cycles through a sequence of values
    语言
  • Binary Tree Maximum DepthImplement a function to find the maximum depth of a binary tree
    语言
  • Flip Binary TreeImplement a function to flip the nodes in a binary tree
    语言
  • Mortgage CalculatorBuild a calculator that computes the monthly mortgage for a loan
    可用的框架
  • Staircase Climbing CombinationsImplement a function to find the number of ways to reach at the top of staircase
    语言
  • Balanced BracketsImplement a function to determine if a string contains balanced brackets
    语言
  • Binary Tree EqualImplement a function to determine whether two binary trees are equal
    语言
  • Bit CountingImplement a function to find number of set bits from 0 to n
    语言
  • Bit ReversalImplement a function to flip the order of the bits in a given number
    语言
  • Linked List ReversalImplement a function to reverse a linked list
    语言
  • String PalindromeImplement a function to determine if a string is a palindrome
    语言
  • Linked List Detect CycleImplement a function to detect if there are cycles in a linked list
    语言
  • Binary Tree SubtreeImplement a function to check if a binary tree is a subtree of another binary tree
    语言
  • Linked Lists Combine Two SortedImplement a function to combine two sorted linked list
    语言
  • Meeting CalendarImplement a function to check if all meetings can be attended
    语言
  • Array Product Excluding CurrentImplement a function to find the product of elements in an array excluding the current element
    语言
  • Binary SearchImplement a function that performs binary search on an array of numbers
    语言
  • Breadth-first SearchImplement a breadth-first search algorithm that traverses a directed graph in a breadth-first manner
    语言
  • Count ByImplement a function that counts the number of times a value appears in an array based on a function or property name
    语言
  • CurryImplement 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
    语言
  • DebounceImplement 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
    语言
  • Depth-first SearchImplement a depth-first search algorithm that traverses a directed graph in a depth-first manner
    语言
  • Heap SortImplement a function that performs a heap sort
    语言
  • Is the Graph a TreeImplement a function to determine if a graph is a valid tree
    语言
  • Maximum Water Trapped Between WallsImplement a function to find the maximum water volume between two walls in an array of walls
    语言
  • PromisifyImplement a function that takes a function following the common error-first callback style and returns a version that returns promises
    语言
  • QueueImplement a queue data structure containing the common queue methods
    语言
  • TabsBuild a tabs component that displays a list of tab elements and one associated panel of content at a time
    可用的框架
  • ThrottleImplement a function to control the execution of a function by limiting how many times it can execute over time
    语言
  • useArrayImplement a hook that manages an array of items
    语言
  • useDebounceImplement a hook that debounces a value
    语言
  • useSetImplement a hook that manages a JavaScript set
    语言
  • useTimeoutImplement a hook that invokes a callback function after a specified delay
    语言
  • useWindowSizeImplement a hook that returns the current height and width of the window
    语言
  • ClassnamesImplement a function that conditionally joins CSS class names together
    语言
  • Data MergingImplement a function to merge rows of data from the same user
    语言
  • Data TableBuild a users data table with pagination features
    可用的框架
  • Dice RollerBuild a dice roller app that simulates the results of rolling 6-sided dice
    可用的框架
  • Event EmitterImplement a class that can subscribe to and emit events that trigger attached callback functions
    语言
  • File ExplorerBuild a file explorer component to navigate files and directories in a tree-like hierarchical viewer
    可用的框架
  • FlattenImplement a function that recursively flattens an array into a single level deep
    语言
  • getElementsByStyleImplement a function to get all DOM elements that are rendered using the specified style
    语言
  • HTML SerializerImplement a function to serialize an object into an HTML string with indentation
    语言
  • JSON.stringifyImplement a function that converts a JavaScript value into a JSON string
    语言
  • Like ButtonBuild a Like button that changes appearance based on the states
    可用的框架
  • List FormatImplement a function that formats a list of items into a single readable string
    语言
  • MemoizeImplement a function that returns a memoized version of a function which accepts a single argument
    语言
  • Merge SortImplement a function that performs a recursive merge sort
    语言
  • MiddlewaresImplement a function that composes asynchronous middleware functions like in Koa.js
    语言
  • Modal DialogBuild a reusable modal dialog component that can be opened and closed
    可用的框架
  • Promise.allImplement the Promise.all() function that resolves to an array of results if all the input elements are resolved or rejects otherwise
    语言
  • Promise.anyImplement the Promise.any() function that resolves when any of the input elements are resolved
    语言
  • Quick SortImplement a function that performs a recursive quick sort
    语言
  • Squash ObjectImplement a function that returns a new object after squashing the input object into a single level of depth
    语言
  • Star RatingBuild a star rating component that shows a row of star icons for users to select the number of filled stars corresponding to the rating
    可用的框架
  • Todo ListBuild a Todo list that lets users add new tasks and delete existing tasks
    可用的框架
  • Topological SortImplement a function that performs a topological sort
    语言
  • Traffic LightBuild a traffic light where the lights switch from green to yellow to red after predetermined intervals and loop indefinitely
    可用的框架
  • useInputControlImplement a hook that manages a controlled input value and tracks its dirty & touched state
    语言
  • useMediaQueryImplement a hook that subscribes and responds to media query changes (e.g. screen size, resolution, orientation, etc.)
    语言
  • useMediatedStateImplement a hook that is similar to useState, but supports a mediation process
    语言
  • useQueryImplement a hook that manages a promise resolution
    语言
  • Binary Tree Level Order TraversalImplement a function to find the level order traversal of a binary tree
    语言
  • Deep CloneImplement a function that performs a deep copy of a value
    语言
  • Deep EqualImplement a function that determines if two values are equal
    语言
  • Digital ClockBuild a 7-segment digital clock that shows the current time
    可用的框架
  • getElementsByClassNameImplement a function to get all DOM elements that contain the specified classes
    语言
  • Map Async LimitImplement a function that maps an array of items with an asynchronous mapping function while not exceeding the concurrency limit
    语言
  • Maximum Sum in Contiguous ArrayImplement a function to find the subarray with the maximum sum
    语言
  • Smallest element in rotated sorted arrayImplement a function to find the smallest element in rotated sorted array
    语言
  • Tic-tac-toeBuild a tic-tac-toe game that is playable by two players
    可用的框架
  • Deep OmitImplement a function that removes specified keys and their corresponding values from an object, including nested objects or arrays
    语言
  • Find Element in Rotated ArrayImplement a function to find an integer in a rotated sorted array
    语言
  • Image CarouselBuild an image carousel that displays a sequence of images
    可用的框架
  • Job BoardBuild a job board that displays the latest job postings from Hacker News
    可用的框架
  • Maximum Product in Contiguous ArrayImplement a function to find the subarray which has the largest product
    语言
  • StopwatchBuild a stopwatch widget that can measure how much time has passed
    可用的框架
  • Transfer ListBuild a component that allows transferring of items between two lists
    可用的框架
  • Binary Search Tree Kth Smallest ElementImplement a function to find the kth smallest node in a BST
    语言
  • Binary Search Tree Lowest Common AncestorImplement a function to find the LCA in a binary search tree
    语言
  • Count Islands in a GridImplement a function to count distinct islands in a 2D binary grid
    语言
  • Delete Nth Node from End of Linked ListImplement a function to delete the nth node from the end of a linked list
    语言
  • Distinct Paths in GridImplement a function to calculate distinct paths for a robot moving on an m x n grid
    语言
  • Matrix ZeroingImplement a function to set matrix rows and columns to zero
    语言
  • Merge Overlapping IntervalsImplement a function to merge overlapping intervals
    语言
  • Most Common ElementsImplement a function to determine the most common elements in an integer array
    语言
  • Neighborhood TheftImplement a function to find maximum money to rob without alerting police
    语言
  • Rearrange Linked ListImplement a function to rearrange the nodes in a linked list
    语言
  • Sum Without AdditionImplement a function to find the sum of two integers without using + and - operator
    语言
  • Triplet SumImplement a function to find all unique triplets with distinct indices that sum to 0
    语言
  • Validate Binary Search TreeImplement a function to validate whether a binary tree is a valid binary search tree
    语言
  • Combinations for Target SumImplement a function to count combinations that sum to the target
    语言
  • Course DependencyImplement a function to check if all courses can be completed given prerequisites
    语言
  • Decode MessageImplement a function to count ways to decode a numeric string
    语言
  • Longest Consecutive Number SequenceImplement a function to find the length of the longest consecutive number sequence
    语言
  • Longest Increasing SubsequenceImplement a function to find the length of the longest increasing subsequence
    语言
  • Minimum Coins for ChangeImplement a function to return minimum coins needed to make the given amount
    语言
  • Palindromic SubstringsImplement a function to count all palindromic substrings in a string
    语言
  • Segment WordsImplement a function to check whether a string be formed from dictionary words
    语言
  • String Anagram GroupsImplement a function to group an array of strings into anagrams
    语言
  • Task CoordinationImplement a function to find minimum intervals for tasks with cooldown
    语言
  • Trie (Prefix Tree)Implement a trie-prefix-tree with insert, search, and starts with functionality
    语言
  • Binary Tree Rebuilding from Preorder and Inorder TraversalsImplement a function to construct a binary tree from preorder and inorder traversals
    语言
  • Disjoint IntervalsImplement a function to determine the minimum amount of removals to get non-overlapping intervals
    语言
  • End of Array ReachableImplement a function to determine if the end of the array is reachable
    语言
  • Find the Longest Palindromic SubstringImplement a function to find the longest palindromic substring
    语言
  • Find Word in GridImplement a function to check the existence of a word in a grid
    语言
  • Graph Count Connected ComponentsImplement a function to count connected components in a graph
    语言
  • Longest Common SubsequenceImplement a function to find the longest common subsequence in two strings
    语言
  • Longest Non-repeating SubstringImplement a function to find the length of longest substring with unique characters
    语言
  • Longest Repeating Substring After ReplacementsImplement a function to find the longest uniform substring after up to k replacements
    语言
  • Matrix RotationImplement a function to rotate the given matrix by 90 degrees
    语言
  • Matrix Spiral TraversalImplement a function to traverse the matrix in spiral order
    语言
  • Merge New IntervalImplement a function to insert a new interval in the given intervals
    语言
  • Neighborhood Theft (Circular)Implement a function to find maximum money to rob in circular houses without alerting police
    语言
  • Ocean FlowImplement a function returning cells with water flow to both oceans
    语言
  • Word FinderImplement a data structure where words can be added and support wildcard searching
    语言
  • Graph CloneImplement a function to deeply clone a connected and undirected graph
    语言
  • Minimum Meeting Rooms NeededImplement a function to find the minimum number of required conference rooms
    语言
  • Binary Tree Serialization and DeserializationImplement a function to serialize and deserialize a binary tree
    语言
  • Binary Tree Maximum Total PathImplement a function to find the maximum total of nodes in a binary tree path
    语言
  • Find Words in GridImplement a function to find all the words present in the grid
    语言
  • Nested CheckboxesBuild a nested checkboxes component with parent-child selection logic
    可用的框架
  • Linked Lists Combine K SortedImplement a function to combine k sorted linked lists
    语言
  • Shortest Substring Containing CharactersImplement a function to return the smallest substring of a string containing all characters from another string
    语言
  • Extraterrestrial LanguageImplement a function to verify and return an extraterrestrial language's alphabet order
    语言
  • Number Stream MedianImplement a function to find the median of a dynamic stream of integers
    语言
  • Clamp高级Implement a function to clamp a number within the inclusive lower and upper bounds
    语言
  • Function Length高级Implement a function that returns the number of parameters expected by a function
    语言
  • Number of Arguments高级Implement a function that returns the number of arguments it was called with
    语言
  • Sleep高级Implement a function that pauses for a specified duration before resuming execution
    语言
  • Array.prototype.square高级Implement a custom Array.prototype.square() method that squares the values in an array
    语言
  • Cancellable Interval高级Implement a function that acts like setInterval but returns a function to cancel the interval
    语言
  • Cancellable Timeout高级Implement a function that acts like setTimeout but returns a function to cancel the pending callback
    语言
  • Chunk高级Implement a function that creates an array of elements split into smaller groups of a specified size
    语言
  • Compact高级Implement a function that creates an array with all falsey values removed
    语言
  • Difference高级Implement a function that finds the difference in values between arrays
    语言
  • Drop Right While高级Implement a function that excludes elements from the end of an array until the predicate returns false
    语言
  • Drop While高级Implement a function that excludes elements from the beginning of an array until the predicate returns false
    语言
  • Fill高级Implement a function that fills an array with values within specified indices
    语言
  • Find Index高级Implement a function that returns the index of the first element in the array that satisfies the provided testing function
    语言
  • Find Last Index高级Implement a function that returns the index of the last element in the array that satisfies the provided testing function
    语言
  • From Pairs高级Implement a function that returns an object composed from key-value pairs
    语言
  • Function.prototype.apply高级Implement the Function.prototype.apply() function that calls the function with a given `this` value and arguments as an array
    语言
  • Get高级Implement a function to safely access deeply-nested properties in JavaScript objects
    语言
  • In Range高级Implement a function to check if a number falls between two numbers
    语言
  • Intersection高级Implement a function that computes the intersection of arrays, returning a new array containing unique values present in all given arrays
    语言
  • Max By高级Implement a function that finds the maximum element based on the specified criteria
    语言
  • Object Map高级Implement a function to transform values within an object
    语言
  • Once高级Implement a function that accepts a callback and restricts its invocation to at most once
    语言
  • Promise.reject高级Implement a function to return a Promise object rejected with a reason
    语言
  • Range高级Implement a function that returns a sequence of numbers in ascending order
    语言
  • Range Right高级Implement a function that returns a sequence of numbers in descending order
    语言
  • Singleton高级Implement a Singleton class that ensures a class has only one instance while providing a global point of access to that instance
    语言
  • Unique Array高级Implement a function to remove all duplicate values from an array
    语言
  • Array.prototype.at高级Implement the Array.prototype.at() method
    语言
  • Array.prototype.filter高级Implement the Array.prototype.filter() method
    语言
  • Array.prototype.map高级Implement the Array.prototype.map() method
    语言
  • Compose高级Implement a function that takes multiple functions as arguments and returns a new function that applies those functions in reverse
    语言
  • Flight Booker高级Build a component that books a flight for specified dates
    可用的框架
  • Function.prototype.bind高级Implement the Function.prototype.bind() function that creates a new function with the `this` keyword set to a provided value
    语言
  • Generate Table高级Generate a table of numbers given the rows and columns
    可用的框架
  • jQuery.css高级Implement a jQuery-like function that sets the style of a DOM element
    语言
  • Progress Bar高级Build a progress bar component that shows the percentage completion of an operation
    可用的框架
  • Promise.race高级Implement the Promise.race() function that resolves or rejects when any of the input elements are resolved or rejected
    语言
  • Size高级Implement a function that returns the size of collection
    语言
  • Sum高级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
    语言
  • Temperature Converter高级Build a temperature converter widget that converts temperature values between Celsius and Fahrenheit
    可用的框架
  • useBoolean II高级Implement an optimized version of the useBoolean hook
    语言
  • useDefault高级Implement a hook that returns the default value when state is null or undefined
    语言
  • useEffectOnce高级Implement a hook that runs an effect only once
    语言
  • useFocus高级Implement a hook that enables programmatic focusing of an element
    语言
  • usePrevious高级Implement a hook that returns the previous value of a state
    语言
  • useStateWithReset高级Implement a hook that's similar to useState but with an additional reset function that resets the state to its initial value
    语言
  • useToggle高级Implement a hook that manages a boolean toggle state
    语言
  • Make Counter II高级Implement a function that returns a counter object with methods to retrieve and manipulate the value
    语言
  • Array.prototype.concat高级Implement the Array.prototype.concat() method
    语言
  • Group By高级Implement a function that groups values in an array based on a function or property name
    语言
  • Intersection By高级Implement a function that returns an array of unique values that are included in all given arrays based on a provided iteratee function
    语言
  • Intersection With高级Computes the intersection of arrays using a custom comparator function to determine equality between elements
    语言
  • Is Empty高级Implement a function to check if a value is an empty object, collection, map, or set
    语言
  • Limit高级Implement a function that accepts a callback and restricts its invocation to at most N times
    语言
  • Promise Merge高级Implement a function to merge the results of two promises into a single value
    语言
  • Promise Timeout高级Implement a function that resolves a promise if it is fulfilled within a timeout period and rejects otherwise
    语言
  • Promise.resolve高级Implement a function to resolve a given value to a Promise
    语言
  • Promise.withResolvers高级Implement a function that returns an object containing a new `Promise` object and two functions to resolve or reject it
    语言
  • Promisify II高级Implement a promisify function that allows the original function to override the return value
    语言
  • Turtle高级Implement a Turtle class that moves a turtle on a 2D plane
    语言
  • Union By高级Implement a function that creates an array of unique values, in order, from all given arrays.
    语言
  • useBreakpoint高级Implement a hook that returns the current breakpoint name based on the current window width
    语言
  • useClickOutside高级Implement a hook that detects clicks outside of a specified element
    语言
  • useCountdown高级Implement a hook that manages a countdown
    语言
  • useEventListener高级Implement a hook that subscribes to browser events
    语言
  • useHover高级Implement a hook that tracks whether an element is being hovered
    语言
  • useInterval高级Implement a hook that creates an interval that invokes a callback function at a specified delay
    语言
  • useKeyPress高级Implement a hook that subscribes to keyboard events
    语言
  • useMap高级Implement a hook that manages a JavaScript map
    语言
  • useObject高级Implement a hook that manages an object value
    语言
  • useStep高级Implement a hook that manages a step counter for a multi-step process
    语言
  • useThrottle高级Implement a hook that throttles a value
    语言
  • Accordion II高级Build an accessible accordion component that has the right ARIA roles, states, and properties
    可用的框架
  • Accordion III高级Build a fully accessible accordion component that has keyboard support according to ARIA specifications
    可用的框架
  • Analog Clock高级Build an analog clock where the hands update and move like a real clock
    可用的框架
  • Camel Case Keys高级Implement a function to convert all the keys in an object to camel case
    语言
  • Compact II高级Implement a function that returns an object with all falsey values removed
    语言
  • Conforms To高级Implement a function that checks if object conforms to source
    语言
  • Curry II高级Implement a function that transforms a function that takes multiple arguments into a function that can be repeatedly called with any number of arguments
    语言
  • Data Table II高级Build a users data table with sorting features
    可用的框架
  • Debounce II高级Implement a debounce function that comes with a cancel method to cancel delayed invocations and a flush method to immediately invoke them
    语言
  • Event Emitter II高级Implement a class that can subscribe to and emit events that trigger attached callback functions. Subscription objects are returned and can unsubscribe itself
    语言
  • File Explorer II高级Build a semi-accessible file explorer component that has the right ARIA roles, states, and properties
    可用的框架
  • File Explorer III高级Build a file explorer component using a flat DOM structure
    可用的框架
  • getElementsByTagName高级Implement a function to get all DOM elements that match a tag
    语言
  • Grid Lights高级Build a grid of lights where the lights deactivate in the reverse order they were activated
    可用的框架
  • Identical DOM Trees高级Implement a function to determine if two DOM trees are the same
    语言
  • jQuery Class Manipulation高级Implement a set of jQuery-like functions that manipulates classes on a DOM element
    语言
  • Map Async高级Implement a function that maps an array of items with an asynchronous mapping function
    语言
  • Modal Dialog II高级Build a semi-accessible modal dialog component that has the right ARIA roles, states, and properties
    可用的框架
  • Modal Dialog III高级Build a moderately-accessible modal dialog component that supports common ways to close the dialog
    可用的框架
  • Progress Bars II高级Build a list of progress bars that fill up gradually in sequence, one at a time
    可用的框架
  • Promise.allSettled高级Implement the Promise.allSettled() function that resolves to an array of outcomes when all the input elements are either resolved or rejected
    语言
  • Resumable Interval高级Implement a function that creates a resumable interval object
    语言
  • Tabs II高级Build a semi-accessible tabs component that has the right ARIA roles, states, and properties
    可用的框架
  • Tabs III高级Build a fully accessible tabs component that has keyboard support according to ARIA specifications
    可用的框架
  • Text Search高级Implement a function to highlight text if a searched term appears within it
    语言
  • useIdle高级Implement a hook that detects user inactivity
    语言
  • Deep Map高级Implement a function to recursively transform values
    语言
  • Progress Bars III高级Build a list of progress bars that fill up gradually concurrently, up to a limit of 3
    可用的框架
  • Text Search II高级Implement a function to highlight text if searched terms appear within it
    语言
  • Birth Year Histogram高级Build a widget that fetches birth year data from an API and plot it on a histogram
    可用的框架
  • Connect Four高级Build a game for two players who take turns to drop colored discs from the top into a vertically suspended board/grid
    可用的框架
  • Deep Merge高级Implement a function that merges two objects together
    语言
  • Image Carousel II高级Build an image carousel that smoothly transitions between images
    可用的框架
  • Memoize II高级Implement a function that returns a memoized version of a function which accepts any number of arguments
    语言
  • Pixel Art高级Build a pixel art drawing tool where users can paint pixels with selected colors
    可用的框架
  • Signup Form高级Build a signup form that does validation on user details and submits to a back end API
    可用的框架
  • Undoable Counter高级Build a counter with a history of the values and ability to undo/redo actions
    可用的框架
  • Users Database高级Build a UI to filter, create, update, and delete users
    可用的框架
  • Whack-A-Mole高级Build a popular arcade game where players attempt to hit moles as they pop up from holes in a board
    可用的框架
  • Memory Game高级Build a memory game where the player needs to match pairs of cards
    可用的框架
  • Curry III高级Implement a function which transforms a function which takes variadic arguments into a function that can be repeatedly called with any number of arguments
    语言
  • Auth Code Input高级Build an auth code input component that allows users to enter a 6-digit authorization code
    可用的框架
  • Classnames II高级Implement a function that conditionally joins CSS class names together and also handles de-duplication and function values
    语言
  • Progress Bars IV高级Build a list of progress bars that fill up gradually concurrently, up to a limit of 3 and allows for pausing and resuming
    可用的框架
  • Backbone Model高级Implement a class resembling Backbone.Model which allows storing of attributes/values and responding to changes in specific attribute values
    语言
  • Data Selection高级Implement a function to filter rows of data matching a specified requirement
    语言
  • Data Table III高级Build a generalized data table with pagination and sorting features
    可用的框架
  • getElementsByTagNameHierarchy高级Implement a function to get all DOM elements that match a tag hierarchy
    语言
  • Modal Dialog IV高级Build a fully-accessible modal dialog component that supports all required keyboard interactions
    可用的框架
  • Table of Contents高级Implement a function to construct a table of contents from an HTML document
    语言
  • Data Table IV高级Build a generalized data table with pagination, sorting and filtering features
    可用的框架
  • Image Carousel III高级Build an image carousel that smoothly transitions between images that has a minimal DOM footprint
    可用的框架
  • Selectable Cells高级Build an interface where users can drag to select multiple cells within a grid
    可用的框架
  • Tic-tac-toe II高级Build an N x N tic-tac-toe game that requires M consecutive marks to win
    可用的框架
  • Transfer List II高级Build a component that allows transferring of items between two lists, bulk selection/unselection of items, and adding of new items
    可用的框架
  • Deep Clone II高级Implement a function that performs a deep copy of a value, but also handles circular references
    语言
  • JSON.stringify II高级Implement a function that converts a JavaScript value into a JSON string
    语言
  • Wordle高级Build Wordle, the word-guessing game that took the world by storm
    可用的框架

JavaScript Interview Questions and Answers

Tired of sifting through poor-quality resources for JavaScript interview preparation? Our comprehensive collection of JavaScript interview questions and answers is your ultimate guide to mastering the skills you need for any JavaScript-based role.

Curated and answered by ex-FAANG interviewers with years of experience, our resource ensures you're prepared for a variety of challenges. Whether you're tackling algorithms, JavaScript functions, or building dynamic user interfaces, our questions are designed to reflect real-world scenarios. Each question is accompanied by detailed explanations, example solutions, and automated test cases, enabling you to refine your skills with immediate feedback.

Our resource is divided into two major categories: JavaScript Coding Interview Questions and JavaScript Quiz Interview Questions, covering a broad spectrum of topics essential for any JavaScript interview.

JavaScript Coding Interview Questions

Master critical JavaScript techniques and coding patterns with our curated list of JavaScript coding interview questions. These questions are designed to help you:

  1. Develop JavaScript data structures and algorithms: Solve challenges involving arrays, strings, linked lists, and more, sharpening your problem-solving skills with JavaScript.
  2. Create and optimize JavaScript Functions: Build modular, reusable, and efficient functions that form the backbone of scalable applications.
  3. Design user interfaces: Use JavaScript to manipulate the DOM, handle user interactions, and implement dynamic content.
  4. Handle real-world scenarios: Address challenges like API integrations, state management, and performance optimization.

Each coding question includes:

  • Example solutions: Step-by-step implementations written in JavaScript to guide you through the problem-solving process.
  • Automated test cases: Instantly validate your solutions, ensuring accuracy and correctness.
  • Best practices: Learn coding techniques that prioritize readability, maintainability, and performance.

Our in-browser coding workspace allows you to practice directly in your browser with no setup required. You'll gain hands-on experience with instant visual feedback, enhancing your understanding of JavaScript coding concepts.

Example coding questions you might encounter include:

  • How to implement a custom debounce function in JavaScript?
  • How to find the longest substring without repeating characters?
  • How to design a collapsible navigation menu dynamically?

Each challenge mimics real-world tasks, equipping you with practical skills that go beyond theory.

JavaScript Quiz Interview Questions

JavaScript quiz questions test your understanding of the language's fundamentals and intricacies. These trivia-style questions cover a wide range of topics, ensuring your readiness for interviews. Here's what you'll explore:

  1. Core JavaScript concepts: Understand key topics such as closures, scope, hoisting, and the event loop.
  2. Performance and optimization: Learn strategies for writing efficient JavaScript code and minimizing performance bottlenecks.
  3. Network and security: Gain insights into handling API requests, Cross-Origin Resource Sharing (CORS), and securing JavaScript applications.
  4. Testing and debugging: Familiarize yourself with tools and techniques for debugging JavaScript code and writing robust test cases.
  5. Advanced features: Explore concepts like async/await, Promises, and modern ES6+ features like destructuring, spread/rest operators, and modules.

Each quiz question comes with:

  • Concise answers (TL;DR): Clear and to-the-point solutions to help you respond confidently during interviews.
  • Comprehensive explanations: In-depth insights to ensure you fully understand the concepts and can elaborate when required.

Example quiz topics include:

  • How does the JavaScript event loop work?
  • What are the differences between let, const, and var?
  • How do you prevent memory leaks in JavaScript?

These questions ensure that you're not only familiar with JavaScript's syntax but also understand how to apply its features effectively in various scenarios.

Why Choose Our JavaScript Interview Questions?

  1. Credibility: All questions and answers are crafted by ex-FAANG interviewers with deep expertise in assessing candidates and building JavaScript solutions for large-scale applications.
  2. Comprehensive coverage: From algorithms and coding patterns to core concepts and advanced features, our resource spans every topic you need to master.
  3. Practical focus: Each question reflects real-world challenges, helping you develop skills that are directly applicable to your career.
  4. Interactive learning: Use our in-browser coding workspace to practice coding problems with instant feedback, simulating real interview conditions.

By leveraging this resource, you'll develop skills that go beyond typical interview preparation. You'll also gain confidence in tackling tasks like solving complex algorithms, debugging JavaScript code, and optimizing performance.

How These Questions Help You Excel

Our JavaScript interview questions are structured to help you:

  1. Master core JavaScript concepts: Strengthen your understanding of JavaScript's syntax, features, and best practices.
  2. Develop problem solving: Learn to approach challenges systematically, breaking them down into manageable steps.
  3. Gain hands-on practical experience: Practice coding problems and see your solutions come to life in our interactive workspace.
  4. Communicate effectively: Prepare to explain your thought process and solutions clearly, a crucial skill in technical interviews.

Real-World Applications

The scenarios covered in this resource aren't just theoretical. They reflect the types of challenges developers face daily, such as:

  • Designing efficient algorithms to process large datasets.
  • Writing reusable JavaScript functions for scalable applications.
  • Debugging and optimizing code for performance across various environments.

By mastering these areas, you'll not only be interview-ready but also prepared to excel on the job, making you a standout candidate for any JavaScript-related role.

Related lists

Check out other lists of questions below if you're looking for something more specific: