---
title: "Discussion on \"Frequently Asked And A Very Famous JavaScript Interview Question\" | Hashnode"
description: "Discussion on \"Frequently Asked And A Very Famous JavaScript Interview Question\". Today we will see a frequently asked Javascript interview question.\nThe question goes like this:\n\nImplement a product method that will return the product of two numbers when invoked using any of the following two ways\n\n\nproduct(4, 5)\nproduct(4)(5)\n\nT..."
url: "https://hashnode.com/posts/frequently-asked-and-a-very-famous-javascript-interview-question/606156425aa4944ee40fab3f"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [Frequently Asked And A Very Famous JavaScript Interview Question](https://blog.yogeshchavan.dev/frequently-asked-and-a-very-famous-javascript-interview-question?utm_source=hashnode&utm_medium=feed)

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...

Mar 29, 2021 · 3 min read · blog.yogeshchavan.dev  
Updated May 5, 2021  
Read the article

-   [#javascript](https://hashnode.com/tag/javascript)
-   [#reactjs](https://hashnode.com/tag/reactjs)
-   [#interview](https://hashnode.com/tag/interview)
-   [#coding](https://hashnode.com/tag/coding)

## Written by

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

@myogeshchavan97 · India

  
[View profile](https://hashnode.com/@myogeshchavan97)

Full Stack Developer | Freelancer | JavaScript | React | Nodejs. https://yogeshchavan.dev/. Book 1:1 @ hiretheauthor.com/myogeshchavan97

Full Stack Developer | Freelancer | JavaScript | React | Nodejs. Loves sharing knowledge through technical articles. Dev.to: https://dev.to/myogeshchavan97 https://linktr.ee/myogeshchavan97

## Responses 2

Markdown supported · ⌘↵ to post

[Sasikumar Reddy Chevvu](https://hashnode.com/@skreddysasi)

[Oct 28, 2023](https://hashnode.com/posts/frequently-asked-and-a-very-famous-javascript-interview-question/606156425aa4944ee40fab3f/comment/653ceac88bb1c48f931a1e0d)

Great Share 🚀, Thanks Yogesh

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

[Oct 28, 2023](https://hashnode.com/posts/frequently-asked-and-a-very-famous-javascript-interview-question/606156425aa4944ee40fab3f/comment/653ceac88bb1c48f931a1e0d#reply-653cf5b67e9ee38b4f5a129c)

Glad to hear that. Thank you [Sasikumar Reddy Chevvu](https://hashnode.com/@skreddysasi)🙏

[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;
 }
```
