mardi 30 juillet 2019

How to write if not in array statement as python in javascript? [duplicate]

This question already has an answer here:

 arr1=[6,4,2,8]
 arr2=[1,5,4,8,2]
 for n in arr2:
     if n not in arr1:
         arr1.append(n)
 print(arr1)

How to write the program in javascript? I m stuck in the if statement.

Aucun commentaire:

Enregistrer un commentaire