JSFiddle - React, Tailwind, and code Playground
by kalar su
HTML
<p id="myProduct"></p>
<p id="myCart"></p>
JavaScript
var product = {
id: "001",
name: "iphone 10",
price : 1000,
impQty : 100,
soldQty : 500,
desc : "iPhone 10 R",
checkAvailability: function(){
return this.impQty - this.soldQty;
}
}
var cart = {
product1: ["001", "iphone10", 1000, 5],
product2: ["002", "iphone6", 500, 1]
}
document.getElementById("myProduct").textContent = product.name;
document.getElementById("myCart").textContent = cart.product1[0];