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

Programming Exercises

Create a function that checks if all elements in an array are equal.

Easy

Problem Statement

Create a function that checks if all elements in an array are equal.

Sample Input

[5, 5, 5, 5]

Sample Output

true

Limits

Time: 2s · Memory: 256 MB

Code Editor
00:00
// Check if all elements in an array are equal function allEqual(array) { return array; } console.log(allEqual([5, 5, 5, 5]));
Log in or sign up to run or submit your code.Log inSign up
Input
[5, 5, 5, 5]
Expected Output
true