docs:programming:javascript:testing_for_existence

Testing For Existence

// test for the existence of an object before doing anything with it
if(typeof someObject == 'undefined'){
	alert('someObject does not exist');
}else{
	alert('someObject exists');
 
	// check for a specific function before calling it
	if(someObject.someFunction){
		someObject.someFunction();
	}
}
  • docs/programming/javascript/testing_for_existence.txt
  • Last modified: 2008/08/03 00:25
  • by 127.0.0.1