JavaScript Coding
This interview requires you to write and execute code in a environment where you can see the logged output of your code.
asyncMap
Transforms each element in an array using an asynchronous mapping function.
classnames
A simple javascript utility for conditionally joining classNames together.
Polyfill: concat( )
Generates a new array by applying a function to each item in environments without native functionality.
mul(a)(b)(c)
Currying is a technique of translating a function that takes multiple arguments into a sequence of functions.
sum(a)(b)(c).....(n)
Currying is a technique of translating a function that takes multiple arguments into a sequence of functions.
Custom Promise
Design a Promise-like class with methods to manually resolve or reject, and to attach callbacks.
Debounce
Debouncing enhances performance by delaying function execution until a certain period of inactivity, preventing unnecessary calls.
Deep Copy
Create a deep copy of an object
Polyfill: filter( )
Creates a new array with elements passing a test in environments lacking native support.
Flatten Array
Takes a nested array and merges all its layers into a single, flat array.
getElementsByStyle
Function to get elements by style property and value.
Identical DOM Trees
Check if two DOM trees are identical.
Polyfill: map( )
Generates a new array by applying a function to each item in environments without native functionality.
Memoize
The memoize function takes a function and returns its memoized variant, optimizing repeated calls by storing previous results.
Object Map
objectMap that works similarly to JavaScript's Array map() method, but for objects.
Polyfill: reduce( )
Transforms an array into a single value using a function in unsupported environments.
Shallow Equality
Shallow equality refers to the comparison of the immediate properties of two objects or arrays, without considering nested properties.
sleep( )
The sleep function is a way to pause or delay the execution of the subsequent code for a specified amount of time.
square( )
Generates a new array with each numeric element squared in environments without native functionality.
Throttle
Throttling optimizes performance by limiting function execution to a specified rate, preventing excessive calls over short intervals.
fetch with cache & expiry
Create a JavaScript function that wraps the native fetch() API with caching capabilities.
City Fetcher API
A classic real world use case for Promise.all
Integers Greater Than
Given a set of integers arr, return a new array of those integers greater than n.
isNumbersOnly
Checks if a given string consists solely of numeric digits, without any spaces, symbols, or decimal points.
promise.all( )
Waits for all promises in an iterable to resolve and returns an array of their results or rejects immediately if any promise is rejected.
promise.any( )
Resolves with the value of the first promise that fulfills from an iterable, or throws an AggregateError if all reject.
Scripts Execution
What would be the correct order of execution of the scripts?
Set
Manages unique elements, allowing for efficient addition, removal, and presence checks without duplicates.
What gets logged?
What gets logged when the following code is executed?
Cancellable Interval
Currying is a technique of translating a function that takes multiple arguments into a sequence of functions.
Cancellable Timeout
Create a timeout function with immediate cancellation capability
Find Security Issue
Could you find a security issue in this code snippet?
Flexible Curry Function
Currying is a technique of translating a function that takes multiple arguments into a sequence of functions.
HEX to RGB
Function that converts a hexadecimal color code to an RGB color code.
Load CSS Dynamically
How can I load CSS dynamically in JavaScript?
Chaining: Calculator
A chaining calculator is a class with methods for arithmetic operations, enabling successive method calls to be linked together in one continuous chain.
useIsMounted
A custom React hook for determining if a component has mounted for client-side vs server-side rendering.
useToggle
A custom React hook for toggling between true and false states.
Cancel Request
How can I abort a Fetch API request in JavaScript, for instance, based on user actions or specific conditions?
Counter Function
Implement a JavaScript function that creates customizable counters.
Caps
Write a function that takes a single string argument and returns the string in all uppercase letters.
Clamp
Write a function that takes a number and returns it clamped between a minimum and maximum value.
Deep Remove Falsy
Remove all falsy values deeply nested in objects and arrays.
Fizz Buzz
A classic programming problem that checks for divisibility by 3 and 5.
Get Number Frequency
A function that counts the frequency of each number in an nested array.
Reverse Words in a String
A function that reverses each word in a given string while maintaining word order.
Toggle
Create a function that cycles through a list of values.
useOnClickOutside
A custom React hook for detecting clicks outside of a specified element.
useCounter
A custom React hook for managing counter state with increment, decrement, reset and step functionality.
useHover
A custom React hook for detecting when an element is being hovered over.
useIdle
A custom React hook for detecting user inactivity after a specified period of time.
usePrevious
A custom React hook for tracking the previous value of a state variable.
useScrollPosition
A custom React hook for tracking window scroll position on both X and Y axes.
Polyfill: apply()
polyfill function that replicates the behavior of the built-in Function.prototype.apply() method.
Polyfill: bind( )
polyfill function that replicates the behavior of the built-in Function.prototype.bind() method.
Polyfill: call( )
polyfill function that replicates the behavior of the built-in Function.prototype.call() method.
multiAdd(1,2)(3)(4,5,6)()
Currying is a technique of translating a function that takes multiple arguments into a sequence of functions.
Custom useMemo Hook
Implement a custom useMemo hook to memoize expensive computations.
Deep Equality
Deep equality checks if two objects or arrays have the same properties and values, including the equality of the nested objects.
Event Emitter
Emits events and registers listeners for handling asynchronous, event-driven operations.
Polyfill: forEach( )
Executes functions on each array element where native support is absent.
getElementsByTagName
Implement a custom version of the getElementsByTagName method from scratch.
inRange
Checks if a given number falls within a specified range, adjusting for order and inclusive of boundaries.
Min Height of DOM Tree
Find the minimum height of the DOM tree.
pipe
Processing data sequentially through functions, where each uses the previous output as input.
Pub Sub
Implements a pattern where subscribers listen for specific events published by a publisher.
Shallow Merge
Shallow merge combines objects, overriding duplicate properties with later values, without merging nested objects.
Traverse DOM Tree
Traverse DOM tree and flatten it into a one-dimensional array in breadth-first order.
Tricky Closure
Closure is not capturing a value, it is preserving access to a variable.
Unique Elements
Filter unique elements from an array
Argument Rotator
Cycle through arguments in sequence upon invocation.
Browser History
Implement a browser history class with navigation functionality like back, forward, and visiting new URLs.
Count by Condition
This function counts the elements in a nested array that satisfy a given condition (callback function).
Deep Flatten Object
Each nested property is transformed into a flat property with keys indicating their path in the original object.
Deep Merge
Seamlessly combines multiple objects, respecting the intricacies of nested structures.
groupBy
Groups the elements of an array based on a specified criterion.
Nested Filtering
Filter multi dimensional array that can contain any type of data.
Paginated Data Ranking
Retrieve and rank articles from a paginated API
promise.allSettled( )
Returns a promise that resolves after all input promises have settled, providing an array with each promise's outcome.
promise.race( )
Returns a promise that resolves or rejects as soon as one of the promises in an iterable settles.
promisify
Converts a callback-based function to a promise-based function.
String to Object
Given a query string, return an object of key value pairs.
this challenge
Classic example of why developers often use the self pattern (or arrow functions)
Throttle Array
Start, pause, reset, and get the current value of the counter.
Analyze Song Data
Extract song metrics from complex listening data strings.
async filter
When the condition is an asynchronous operation, it adds a layer of complexity.
async reject
When the condition is an asynchronous operation, it adds a layer of complexity.
Capturing in IIFEs
Closures and nested functions in JavaScript using IIFEs.
Chop into Chunks
Creates a new array where the original array is divided into multiple chunks each of the specified size.
clearAllIntervals
A function that clears all active JavaScript intervals at once.
clearAllTimeouts
A function that clears all active JavaScript timeouts at once.
Click by Domains
Record the clicks for each domain and subdomain.
Clock Angle
Function to calculate the angle between the two hands on a clock representing that time.
Contiguous History
The longest contiguous sequence of URLs that appears in the browsing histories of users.
Controllable Counter
Automated counter in JavaScript that can be controlled programmatically.
getElementsByClassName
Implement a custom version of the getElementsByClassName method from scratch.
Immutability Challenge
Enhance a given class to return immutable copies of its instances and provide a method to check their mutability.
Local Storage Expiry
Extend the functionality of the browser's localStorage to include an expiry feature.
Once
callback function is only invoked once.
Parallel Async
Executes multiple asynchronous functions concurrently, without waiting for any to complete before starting the next.
Retry Promise N Times
The function retries a promise returning function with optional delays until success or a max attempt limit.
Roll Call
Creates a function that allows you to call out names from an array one by one.
Sequential Async
Executes asynchronous functions in sequence, each starting only after the previous one has completed.
Snake to Camel
Convert snake case string to camel case string.
Calendar Manager
Determine availability within a calendar, analyzing a set of times in 24-hour format against a desired slot.
compose
Processing data sequentially through functions in reverse order, where the output of the last function becomes the input of the previous.
Counter Advanced
Implement a JavaScript function that creates counter objects with multiple operations.
Assertion Function
Implement a simple assertion function similar to Jest's expect function
Debounce Without Timer
Debouncing enhances performance by delaying function execution until a certain period of inactivity, preventing unnecessary calls.
Digital Clock
A function that creates a digital clock that updates every second in the console.
findPattern
Groups the elements of an array based on a specified criterion.
Min Max Stack
A stack that also tracks minimum and maximum values efficiently, enabling quick retrieval.
Queue
Adheres to First-In-First-Out (FIFO) for orderly item processing, with items added and removed from opposite ends.
Right or wrong?
Make sure the log function outputs the right value.
Stack
Follows Last-In-First-Out (LIFO) with operations like push and pop, ideal for history tracking.
Number + String
Write a function that takes a number and a string and returns the sum of both.
parseNumber
Parse numbers from strings using character codes.
Timer Manager
The TimerManager class in JavaScript manages multiple timers, offering multiple functionalities.
Transactions Sum
Group and aggregate a list of transactions by month and category for a given year, calculating totals.
Digital Root
Calculate the digital root of a number.
API: fetch with timeout
Implement a fetch function with timeout functionality to handle network requests that take too long.
Pokemon Rating Display
Take the rating for that pokemon and return a DIV element with the text.
Remove Falsy
Remove all falsy values from an array in JavaScript.