JSFiddle - React, Tailwind, and code Playground
JavaScript
var kbComps = [];
var products = [{
id: 23498213479,
title: 'Practical Silk Bag',
handle: 'practical-silk-bag',
vendor: 'Legros, Willms and Von',
product_type: 'Bag',
}];
//loop through the inventory, looking for everything that is a keyboard or a computer
for (var key in products) {
console.log("key", key);
var item = products[key];
console.log("item", item);
for (var property in item) {
console.log("item", item);
console.log(property);
if (typeof item[property] === 'string' && (item[property].includes("Silk") || item[property].includes("Keyboard"))) {
kbComps.push(item);
}
}
}
console.log(kbComps);