...

View Full Version : True/false



martynball
02-22-2010, 01:51 AM
How do I check to see if a function returns true before excecuting code?

martynball
02-22-2010, 02:17 AM
Dunna matter, simple, me being stupid.



if (function()==true) {
//Do this
}

JAY6390
02-22-2010, 02:37 AM
If you want to check if it is explicitly true, you would use

if(function() === true) {
// Run this code
}

If you want a shorter version of your code above you could just use

if(function()) {
// Run this code
}



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum