The following arrow function has been defined:

let multiply = (m, n) => m * n;

How would you rewrite the function without changing what it does? Select the correct definition.

  • let multiply = (m, n) =>
        return (m * n);
  • let multiply = (m, n) => {
        m * n;
    }
  • let multiply = (m, n) => {
        console.log(m * n);
    }
  • let multiply = (m, n) => {
        return (m * n);
    }
Explanation & Hint:

To rewrite the given arrow function without changing its functionality you would have to do this:

let multiply = (m, n) => {return (m * n);}

The multiply variable is declared using the let keyword.
It is assigned a function that takes two parameters m and n.
Inside the function body, the product of m and n is calculated using the multiplication operator *.

The calculated result is returned using the return keyword.
The function expression is terminated with a semicolon ;.

For more Questions and Answers:

JavaScript Essentials 1 | JSE1 – Module 5 Test Exam Answers Full Score 100%