Code: Select all
function returnTrue()
{
return true;
}
function returnFalse()
{
return false;
}
Code: Select all
function returnTrue()
{
return true;
}
function returnFalse()
{
return false;
}
Code: Select all
var useThisVal,
x = thisReturnsIntZero(),
y = thisReturnsIntTen();
useThisVal = parseInt(x || y);
Code: Select all
if (0 || null || undefined || false)
{
//Never executes!
}
if (1 || true) {
//Always executes!
}
Code: Select all
if ('some string') {
//Always executes
}
Code: Select all
function truthiness(truthiness)
{
return truthiness;
}
Yeah it sucks sometimes. It just lets you get away with so much. I've been using Ext for the past couple years and it certainly makes things a lot easier. I don't know if it's a good thing or a bad thing that almost everyone uses some third party javascript framework to make javascript better. Not sure what that says about the language...bannination wrote:Yeah, I pretty much just all around hate javascript. Writing it is just fine, reading someone else's with no comments or context, forget it. Well, I bang my head on the desk and do it anyway.
I joked that I rewrote those functions as:
There could have been very good reasons for those functions. I just couldn't find them in the rest of the code, which was ... probably > 6000 lines. Ugh...Code: Select all
function truthiness(truthiness) { return truthiness; }