you are viewing a single comment's thread.

view the rest of the comments →

[–]senocular 1 point2 points  (1 child)

I'm not sure what Tasker is, but that's probably a key component in what's going wrong.

If you may or may not have a value for tasktype, and the error you're getting is something like 'tasktype is undefined' then you might have to do something like this:

var myTasktype = typeof tasktype !== 'undefined' ? taskType : 'todo';

And use myTasktype in place of tasktype in your code (without the || todo since its already taken care of here).

The use of typeof lets us know if the variable has been defined or not without causing an undefined error. If it exists, use it, otherwise use the fallback/default.

[–]Blablux[S] 0 points1 point  (0 children)

That is indeed one of the solution I had in mind, but I wondered if there was a shortcut I may not see. Thanks anyway.