Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

"default" keyword?

Status
Not open for further replies.

sjohnson

Technical User
Dec 18, 2002
2
US
hi!

What is the 'default' keyword used for in Javascript?

Thanx
SJ
 
As far as I know it is a reserved word only - not in use just yet.
-Ben "Alright whatever man, I'll hook up the hair, but I aint touchin the ring...Cause I'm still a pla--yer"
 
default is used in conjuction with the switch statement; if none of the conditions are met, it is executed... example below:

switch(x)
{
case 1:
//if x is one, this code is executed
break
case 4:
//if x is four, this code is executed
break
default:
//if x is neither, this code is executed
break;
} jared@aauser.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top