-2

This is my ruby code.

array1= [1,2,3,4,5]
array2= [2,3,4,5,6]
if (array1 & array2).size == 4
   puts "4 match"

How can I write the same thing in javascript? Is there any material like ruby-doc in javascript?

sawa
  • 160,959
  • 41
  • 265
  • 366
user3083380
  • 171
  • 1
  • 1
  • 5

1 Answers1

1

There isn't a native method do do it. Have a look at here : Simplest code for array intersection in javascript

The best documentation I know about javascript and html5 is the Mozilla developer network.

Community
  • 1
  • 1
Sebastien C.
  • 4,419
  • 1
  • 18
  • 32