Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Web Programming > JavaScript > Javascript How-To
|
Javascript How-To Ask your "How do I do this with Javascript?" questions here.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Javascript How-To section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old October 6th, 2005, 05:17 AM
Friend of Wrox
 
Join Date: Jan 2005
Posts: 1,525
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to crmpicco Send a message via AIM to crmpicco Send a message via MSN to crmpicco Send a message via Yahoo to crmpicco
Default check if an array element is not undefined

Code:
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
__________________
_______________________
Ayrshire Minis - a Mini E-Community
http://www.ayrshireminis.com
http://www.crmpicco.co.uk
 
Old October 6th, 2005, 11:40 AM
Friend of Wrox
 
Join Date: Jul 2003
Posts: 683
Thanks: 0
Thanked 1 Time in 1 Post
Default

You can just compare the array element to undefined...
Code:
var myArr = [];
alert(myArr[5] == undefined);
HTH,

Chris






Similar Threads
Thread Thread Starter Forum Replies Last Post
check name of the current node element in xml arunagottimukkala XSLT 19 October 19th, 2007 04:44 AM
Problem -- Empty element check ! back2grave XSLT 2 July 10th, 2006 04:58 PM
Check if string is in element hykyit XSLT 3 May 1st, 2006 09:26 AM
check if element is disabled or enabled crmpicco Javascript How-To 1 November 10th, 2005 07:21 PM
Array Element android66 Javascript 2 November 12th, 2004 04:50 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.