Monday, June 3, 2024
 Popular · Latest · Hot · Upcoming
96
rated 0 times [  98] [ 2]  / answers: 1 / hits: 165772  / 12 Years ago, fri, april 13, 2012, 12:00:00

Is there any better way of doing this?



if(borrar() !== false)
{
alert('tatatata bum bum bum prapra');
}
return false;

More From » ajax

 Answers
5

If you want to check for false and alert if not, then no there isn't.


If you use if(val), then anything that evaluates to 'truthy', like a non-empty string, will also pass. So it depends on how stringent your criterion is. Using === and !== is generally considered good practice, to avoid accidentally matching truthy or falsy conditions via JavaScript's implicit boolean tests.


[#86260] Thursday, April 12, 2012, 12 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
tammyb

Total Points: 278
Total Questions: 101
Total Answers: 103

Location: Botswana
Member since Sat, Jan 7, 2023
1 Year ago
tammyb questions
Sat, Aug 15, 20, 00:00, 4 Years ago
Wed, Sep 25, 19, 00:00, 5 Years ago
Sun, Jun 9, 19, 00:00, 5 Years ago
;