`intersection between arrays

  • Construct a function intersection that compares input arrays and returns a new array with elements found in all of the inputs. BONUS: Use reduce!`

function intersection(arrays) {


console.log(intersection([5, 10, 15, 20], [15, 88, 1, 5, 7], [1, 10, 15, 5, 20]));
//should log: [5, 15]

Can you provide a link to the challenge?

What have you tried so far, can you describe which steps you’ll have to take to solve this?

I’ve edited your post for readability. When you enter a code block into a forum post, please precede it with a separate line of three backticks and follow it with a separate line of three backticks to make it easier to read.

You can also use the “preformatted text” tool in the editor (</>) to add backticks around text.

See this post to find the backtick on your keyboard.
Note: Backticks (`) are not single quotes (’).

Do you have a question?

The more information you give us, the more likely we are to be able to help.