Store Multiple Values in one Variable using JavaScript Arrays

Tell us what’s happening:

i want when my array match then show me one result.

Your code so far

(function () {
  var count = 0;
 var result = ["left", "left", "left","one"];
  $('.skip_btn1').click(function () {
    count += 1;

    if (count == 4) {
      if (store === result) {
  // console.log(store);
      alert ("it's a match!");
    } else {
                alert ("it's not a match!");

    //	alert('yes');
      // come code
    //  $('#questions').hide();
    //  $('.main').show("slow");
**Your browser information:**

Your Browser User Agent is: ```Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.84 Safari/537.36```.

**Link to the challenge:**

In your code you are referencing a variable named store. You have not declared that variable in the code above. Once you tell me that, I can help you.

Like @n_haniph said, you need to define what store is. However, no matter what store is, the following line:

if (store === result) {

will evaluate to false, because you are trying to compare something to an array. Even if store is an array, you can not compare two arrays in this manner. You must compare each individual element of one array to each individual element of the other array using some kind of iteration method (i.e. for loop, while loop, etc…).

1 Like