Practice Real Company Assessment Patterns • Latest 2025–2026 Mock Tests

Programming Exercises

Create a function that uses throttling to limit a function’s execution rate.

Hard

Problem Statement

Create a function that uses throttling to limit a function’s execution rate.

Sample Input

Function to throttle: logMessage
Throttle interval: 1000 ms
Number of calls to logMessage: 3

Sample Output

Only one output every 1000ms.

Limits

Time: 2s · Memory: 256 MB

Code Editor
00:00
// Implement throttling to limit function execution rate function throttle(func, limit) { // Track the last execution time and set a timeout for additional calls } // Example function to throttle function logMessage() { // Log a message to the console } const throttledLog = throttle(logMessage, 1000); throttledLog(); throttledLog(); throttledLog();
Log in or sign up to run or submit your code.Log inSign up
Input
Function to throttle: logMessage
Throttle interval: 1000 ms
Number of calls to logMessage: 3
Expected Output
Only one output every 1000ms.