find length of array code example

Example 1: length of an array javascript

const clothing = ['shoes', 'shirts', 'socks', 'sweaters'];

console.log(clothing.length);
// expected output: 4

Example 2: length of an array javascript

array.length

Example 3: length of array in java

arr.length;

Example 4: get length of array in c

int a[17];
size_t n = sizeof(a)/sizeof(a[0]);

Example 5: js length of array

arr = ["a", "b", "c"];
len = arr.length; // 3

Example 6: get length of array

// In Javascript
var x = [1,2,3];
console.log(x.length);

Tags:

Java Example