<!DOCTYPE html>
<html>
<body>
<h1>JavaScript Arrays</h1>
<h2>The length Property</h2>
<p>The length property returns the length of an array:</p>
<p id="workingdemo"></p>
<script>
const hero = ["Antman","Batman","Spiderman","Wonderwoman","ironman"];
let size = hero.length;
document.getElementById("workingdemo").innerHTML = size;
</script>
</body>
</html>
Output
JavaScript Arrays
The length Property
The length property returns the length of an array:
5
Use of length() method in Javascript
admin Changed status to publish December 19, 2023