Search posts, tags, users, and pages
Chety
You can check your second parameter as below without 0 trap.
0
if (b != undefined) { // if b provided return a * b; }
Yogesh Chavan
Chety Thanks, that will work but it's always good to use strict comparison inside if condition to avoid type coercion like this:
if (b !== undefined) { // if b provided return a * b; }