Subject: check if an array element is not undefined
Posted By: crmpicco Post Date: 10/6/2005 5:17:30 AM


if (typeof(seatArr[s-1]) != "undefined")
                        {
                            el.innerHTML = el.innerHTML + seatArr[s-1];
                        }
                    

                    will this work to check if an array element is not undefined?

www.crmpicco.co.uk
Reply By: ChrisScott Reply Date: 10/6/2005 11:40:58 AM
You can just compare the array element to undefined...

var myArr = [];
alert(myArr[5] == undefined);

HTH,

Chris


Go to topic 35364

Return to index page 458
Return to index page 457
Return to index page 456
Return to index page 455
Return to index page 454
Return to index page 453
Return to index page 452
Return to index page 451
Return to index page 450
Return to index page 449