Array.length problem in JavaScript – Education Career Blog

I’ve written this sample code to print the length of x. But for some reason, I am not getting anything! Help!

<script type = "text/javascript">
function myF()
   var x = 1,2,3,4;
   var y = document.getElementById("thing");
   y.innerHtml = x.length;

<body onload = "myF();" >

<div id = "thing" >



The property name is innerHTML rather than innerHtml.

Leave a Comment