Today we will see a frequently asked Javascript interview question. The question goes like this: Implement a product method that will return the product of two numbers when invoked using any of the following two ways product(4, 5) product(4)(5) T...

Markdown supported Β· ββ΅ to post
You can check your second parameter as below without 0 trap.
if (b != undefined) { // if b provided
return a * b;
}
Sasikumar Reddy Chevvu
Front End Developer
Great Share π, Thanks Yogesh