jeudi 13 décembre 2018

How to use 'if' in the case of that it is true if one data is included in an array by javascript?

I have a question whether this is possible or not.
For example, there is one code like below. But that code has an erroy for sure.
And I want to make 'if' is ture when one data is at some array.
Could you recommend some method? Thank you so much.

var a = 1;
var model2 = {1, 2, 3};
if (a == model2) {
    var b = a;
   }
else {
    var c = a;
   }

Aucun commentaire:

Enregistrer un commentaire