Fonksiyon içindeki değeri fonksiyon dışına yazdırmaya çalışıyorum fakat içeriğini yazmıyor.
Bir de şöyle bir sorunum var.
Const productcontroller = (() => {
Const data = {
Product: [
{name: "Monitör", price: 1000},
{name: "Fare", price: 100},
{name: "Klavye", price: 150}
],
Totalprice: 0,
}
Let i = 0;
For(i; i<data. Product. Length; i++){
Data. Product.ID = i;
}
Return{
Getproduct: (() => {
Return data. Product;
})(),
Getdata: (() => {
Return data;
})(),
}
})();
Şöyle bir kod bloğum var yukarıdaki resimde addlist fonksiyonumun içine console.log(data. Getproduct) yazınca gene boş bir obje alırken addlist fonksiyonu dışında bir yere yazdığımda çalışıyor.
Bir de şöyle bir sorunum var.
Const productcontroller = (() => {
Const data = {
Product: [
{name: "Monitör", price: 1000},
{name: "Fare", price: 100},
{name: "Klavye", price: 150}
],
Totalprice: 0,
}
Let i = 0;
For(i; i<data. Product. Length; i++){
Data. Product.ID = i;
}
Return{
Getproduct: (() => {
Return data. Product;
})(),
Getdata: (() => {
Return data;
})(),
}
})();
Şöyle bir kod bloğum var yukarıdaki resimde addlist fonksiyonumun içine console.log(data. Getproduct) yazınca gene boş bir obje alırken addlist fonksiyonu dışında bir yere yazdığımda çalışıyor.