Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

8.1.2. Array Length¶

/*To check the length of an array, use the length property, just like
with strings. JavaScript array length is NOT fixed, meaning you can
add or remove items dynamically.*/

//Print out the length of two arrays.
let emptyArray = [];
console.log(emptyArray.length);

let programmingLanguages = ["JavaScript", "Python", "Java", "C#"];
console.log(programmingLanguages.length);

//0
//4
Source by education.launchcode.org #
 
PREVIOUS NEXT
Tagged: #Array
ADD COMMENT
Topic
Name
6+9 =