FrontendAtlas
Study
▾
Dashboard
Pricing
Get full access
</> Code
Test cases
Language
JavaScript
TypeScript
export default function arraysEqual(a, b) { // TODO: Return true if both arrays contain the same elements in the same order throw new Error('Not implemented'); }
import arraysEqual from './arraysEqual'; describe('arraysEqual', () => { test('returns true for identical arrays', () => { expect(arraysEqual([1, 2, 3], [1, 2, 3])).toBe(true); }); test('returns false for different element order', () => { expect(arraysEqual([1, 2, 3], [3, 2, 1])).toBe(false); }); test('returns false for different lengths', () => { expect(arraysEqual([1, 2], [1, 2, 3])).toBe(false); }); test('works with string arrays', () => { expect(arraysEqual(['a', 'b'], ['a', 'b'])).toBe(true); }); test('returns false for mixed type differences', () => { expect(arraysEqual([1, '2', 3], [1, 2, 3])).toBe(false); }); test('handles empty arrays', () => { expect(arraysEqual([], [])).toBe(true); }); });
▶ Run tests
Results
Console
Run tests to see results.