0

Array of Object Image

var secondVariations;

this is the array of object name what you are seeing in the image.

I have the above Array of Object. But I can't search an item in this. What is the problem?

It's giving me undefined

let value_of_select = 7;
let variationListTargettedValueOfSelect = secondVariations.find(obj => {
       return obj.id === value_of_select;
});

I also used filter but same result! What my mistake?

Code Structure:

var secondVariations;
$.ajax({
   -----
   success:function(response){
      secondVariations = response;
});

// I have a select-option in success {} block. After firing this 

$(document).on('change', '.select-class' , function(){
let value_of_select = 7;
let variationListTargettedValueOfSelect = secondVariations.find(obj => {
       return obj.id === value_of_select;
});
});
Aspile Inc
  • 119
  • 2
  • 10

0 Answers0