Skip to main content

Code Golf · #40 · 2026-05-14

Array intersection

Difficulty 2/3 · JavaScript

How to play

Write a JavaScript function body that passes all test cases using the fewest characters. Run against examples first, then submit for the full test suite. Eagle < Birdie < Par.

Given [arr1, arr2], return elements that appear in both arrays (preserve order from arr1).

Examples

f([[1,2,3],[2,3,4]]) 2,3
f([[1,2],[3,4]])

Loading your progress...

Your code (function body — receives input)

function(input) { 0 chars
}

Write the shortest JavaScript function body that passes all tests · Back to hub