Untitled
unknown
javascript
10 months ago
365 B
13
Indexable
const ogrenci = {
ad: "Erhan",
soyad: "Kutlu",
notlar: [100, 80, 90, 90],
ortalamaHesapla: function () {
let toplam = 0;
this.notlar.forEach(not => {
toplam += not;
});
return toplam / this.notlar.length;
}
};
const ortalama = ogrenci.ortalamaHesapla();
console.log("Ogrencinin not ortalamasi: " + ortalama);Editor is loading...
Leave a Comment