frontend-challenges icon indicating copy to clipboard operation
frontend-challenges copied to clipboard

FrontendChallenges is a collection of frontend interview questions and answers. It is designed to help you prepare for frontend interviews. It's free and open source.

Results 109 frontend-challenges issues
Sort by recently updated
recently updated
newest added

index.ts ```ts index.ts export const shuffle = (arr: number[]) => { let result: number[] = []; for (let i = 0; i < arr.length; i++) { const randIndex = Math.floor(Math.random()...

answer
typescript
158

index.js ```js index.js export function debounce(func, delay, options = {}) { const { leading = false, trailing = true } = options; let timerId; const debounced = function () {...

answer
javascript
459

index.js ```js index.js export function throttle(func, wait, options = {}) { const { leading = true, trailing = true } = options; let timer = null; let lastArgs = null;...

answer
javascript
432

index.js ```js index.js export function throttle(cb, delay = 250) { let shouldInvoke = true; return (...args) => { if (shouldInvoke) { shouldInvoke = false; cb.call(this, ...args); setTimeout(() => { shouldInvoke...

answer
javascript
20

index.js ```js index.js function curry(fn) { function curried(...args) { // If enough args and no placeholders → call fn if (args.length >= fn.length && args.every(arg => arg !== __)) {...

answer
javascript
455

index.js ```js index.js /** * @param {Function} fn - original function to curry * @returns {Function} */ export function curry(fn) { return function curried(...args) { if (args.length >= fn.length) {...

answer
javascript
449

index.ts ```ts index.ts /** * Retrieves a value from an object via a path. */ export function get( object: T, path: string | Array, defaultValue?: R, ): R | unknown...

answer
typescript
446

index.ts ```ts index.ts export function deepClone(value: T): T { if (typeof value !== "object" || value === null) { return value; } if (Array.isArray(value)) { return value.map((item) => deepClone(item)) as...

answer
typescript
442

index.ts ```ts index.ts /** * Converts a snake_case string to camelCase. */ export function snakeToCamel(input: string): string { const words = input.split("_").filter(Boolean); for (let i = 0; i < words.length;...

answer
typescript
439

index.ts ```ts index.ts export async function retryPromise(fn: () => Promise, retries: number): Promise { return fn().catch((error) => { if (retries > 0) { return retryPromise(fn, retries - 1); } throw...

answer
typescript
428