function ekranShow(data) {
data.forEach((elelment) => {
console.log(elelment);
}); }
fetch("https://fakestoreapi.com/products")
.then((j) => j.json())
.then((ij) => ekranShow(ij))
.catch((err) => console.log(err));
function yangiTavarr(Tavar){
fetch("https://fakestoreapi.com/products", {
method: "POST",
headers: {
"Content-Type": "application/json"
},
body: JSON.stringify(Tavar)
})
}
yangiTavarr({title: "3ta function", price: 100, description: "3ta function haqida", image: "https://fakestoreapi.com/img/81fPKd-2AYL._AC_SL1500_.jpg", category: "electronics"})
function changeTavar(data, soni){
fetch(`https://fakestoreapi.com/products/${soni}`), {
method: "DELETE",
}
}
changeTavar(3);