Tag Archives: KunciProperti

Program JavaScript untuk Menghitung Jumlah Kunci/Properti dalam Objek

Contoh 1: Hitung Jumlah Kunci dalam Objek Menggunakan for…in // program to count the number of keys/properties in an object const student = { name: ‘John’, age: 20, hobbies: [‘reading’, ‘games’, ‘coding’], }; let count = 0; // loop through each key/value for(let key in student) { // increase the count ++count; } console.log(count); Keluaran […]