I have a selection of properties with the div id of property_id that passes an id value. I have an event listener that triggers when a user selects a property. I want to create a conditional that checks if the property selection is in the array.
document.getElementById('property_id').addEventListener('change', function (e) {
 var array = [1, 17, 20, 23, 87]
 var propertySelection = e.target.value;
 if (array.includes(propertySelection)) {
   //do stuff
 }
});
Doing console.log(propertySelection) provides the correct number when selecting properties (ie. 17, 2, 20 etc), but doing console.log(array.includes(propertySelection)) outputs false on all accounts. Why is this?
 
    