---
title: "Comment by Chety on \"Frequently Asked And A Very Famous JavaScript Interview Question\" | Hashnode"
description: "You can check your second parameter as below without 0 trap. if (b != undefined) { // if b provided return a * b; }"
url: "https://hashnode.com/posts/frequently-asked-and-a-very-famous-javascript-interview-question/606156425aa4944ee40fab3f/comment/60622e74cdd0a2790f53ada3"
---

[Discussion](https://hashnode.com/posts/frequently-asked-and-a-very-famous-javascript-interview-question/606156425aa4944ee40fab3f)

Comment [Frequently Asked And A Very Famous JavaScript Interview Question](https://hashnode.com/posts/frequently-asked-and-a-very-famous-javascript-interview-question/606156425aa4944ee40fab3f)

[Chety](https://hashnode.com/@MereMala)

[Mar 29, 2021](https://hashnode.com/posts/frequently-asked-and-a-very-famous-javascript-interview-question/606156425aa4944ee40fab3f/comment/60622e74cdd0a2790f53ada3)

You can check your second parameter as below without `0` trap.

```
if (b != undefined) { // if b provided
  return a * b;
 }
```

[Yogesh Chavan](https://hashnode.com/@myogeshchavan97)

[Mar 30, 2021](https://hashnode.com/posts/frequently-asked-and-a-very-famous-javascript-interview-question/606156425aa4944ee40fab3f/comment/60622e74cdd0a2790f53ada3#reply-6062b61e3f8d1e7934c1cf1c)

[Chety](https://hashnode.com/@MereMala) 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;
 }
```
