Javascript Data Type How to - Check item of array on "undefined"


We would like to know how to check item of array on "undefined".


<!DOCTYPE html>
<script type='text/javascript'>
<!--from  w  ww  .ja v a  2 s .  c o  m-->
var arrayResults = [5,1,,5,6,,10];
for (var i = 0, l = arrayResults.length; i < l; i++) {
    if (typeof(arrayResults[i])=='undefined') {
         document.writeln('Element ' + i + ' is undefined.');


The code above is rendered as follows: