Thursday, June 12, 2014

Misplaced semiconlon and debugging fun in Javascript

This is frustrating and funny at the same time. I've been stuck at this simple condition statement wondering my nulled variable didn't check out true ... for about 5 minutes.

Turns out I totally missed ';' at the end of the if statement, which ended the condition and executed the next block of code anyway.


listview_tasks=null;


...


if(!listview_tasks);
{
    Ti.API.info("why am I here?");

}

Argh.

I blame the tiny font I'm using on my IDE. 

Time for a break me thinks.



No comments: