Build a Calculator - Step 18

Tell us what’s happening:

I don’t understand how to do this step and I couldn’t find anything for this step in the forum. Since this is the basic build a calculator.

Your code so far

function calculateSum(num1, num2) {
  return num1 + num2;
}

console.log(calculateSum(2, 5));
console.log(calculateSum(10, 10));
console.log(calculateSum(5, 5));

function calculateDifference(num1, num2) {
  return num1 - num2;
}

console.log(calculateDifference(22, 5));
console.log(calculateDifference(12, 1));
console.log(calculateDifference(17, 9));

function calculateProduct(num1, num2) {
  return num1 * num2;
}

console.log(calculateProduct(13, 5));


function calculateQuotient(num1, num2) {
  return num2 === 0 ? "Error: Division by zero" : num1 / num2;
}

console.log(calculateQuotient(7, 11));
console.log(calculateQuotient(3, 0));

function calculateSquare(num) {
  return num ** 2;
}

console.log(calculateSquare(2));
console.log(calculateSquare(9));


// User Editable Region

function calculateSquareRoot(num) {return num / num}


// User Editable Region

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:151.0) Gecko/20100101 Firefox/151.0

Challenge Information:

Build a Calculator - Step 18

GitHub Link: freeCodeCamp/curriculum/challenges/english/blocks/workshop-calculator/66cc2739f687e484d50bb6f1.md at main · freeCodeCamp/freeCodeCamp · GitHub

In the example, how is square root determined?

To get the square root of a number in JavaScript, you can use the Math.sqrt() method.

Here is an example:

// result: 3
Math.sqrt(9);

I had tried that but for some reason it didn’t work.

Please show what you tried.

never mind might had had a typo the first time I tried it.