While debugging javascript written by someone else, I came across some code that I've not seen before. Here's a sample:
function doSomething() {
//doing something here...
}
function doItNow() {
//other logic...
doSomething && doSomething(); // <=== What's this?
}
Is the purpose of the 2nd line in function doItNow() to check if doSomething exists and then call it? Like so:
function doItNow() {
//other logic...
if (doSomething) {
doSomething();
}
}
JSLint does not like it and I'd rather not have bad code in my app. Any insights?