Currently, I am referring to this specific example. However, in my case, I am looking to retrieve data from a JSON file instead of utilizing local data. The scenario is:
function store() {
this.products = [
new product("APL", "Apple", "Eat one every day to keep the doctor away!", 12, 90, 0, 2, 0, 1, 2),
new product("AVC", "Avocado", "Guacamole anyone?", 16, 90, 0, 1, 1, 1, 2)
];
}
store.prototype.getProduct = function (sku) {
for (var i = 0; i < this.products.length; i++) {
if (this.products[i].sku == sku)
return this.products[i];
}
return null;
}
In my situation, there exists a straightforward file with the name "Product.json". My objective is to extract all necessary data directly from that file without making any other modifications.