I want to filter the following objects by category_id using the following array of category_id values:
[19012000, 19012001, 19012002, 19012003, 19012004, 190
indexOf()
with a string and a number
var a = [123];
console.log(a.indexOf(123)); //true
console.log(a.indexOf("123")); //false
Your code is not working because you are comparing a string in your object to the numbers in your array.
category_id.indexOf(+n.category_id)
or
category_id.indexOf(parseInt(n.category_id, 10))