Java script : length property

length property

We may wish to know how many items are stored inside of an array.
Kita bisa menemukan ini dengan menggunakan salah satu dari length. We can attach this to any variable holding an array and it will return the number of items inside.
let newYearsResolutions = ['Rappel into a cave', 'Take a falconry class']; console.log(newYearsResolutions.length); // Output: 2
Pada contoh di atas, kami mencatat newYearsResolutions.length panjang ke konsol. Kode ini mengambil properti length property of the newYearsResolutions array and logs it to the console. This array has two items, so 2 would be logged to the console.
1.
Find the length of your newYearsResolutions array and log it to the console.

Tidak ada komentar:

Posting Komentar