<html>
<body>
<p id="demo">Click the button to create an array, then display it's length</p>
<button onclick="myFunction()">Try it</button>
<script>
function myFunction()
{
var fruits = ["Banana", "Orange", "Apple", "Mango"];
var x=document.getElementById("demo");
x.innerHTML=fruits.length;
}
</script>
</body>
</html>