Get the square

Report a typo

In the code below there is a function named getTheSquare. This function will receive an array with three objects in it; each object has two keys source and square.

Your task is to take the value of the source key and calculate its square root and store the result in the square key.

You don't need to print anything, just return the arrayOfObjects.

Sample Input 1:

[{"source":16,"square":null},{"source":64,"square":null},{"source":121,"square":null}]

Sample Output 1:

[
  { source: 16, square: 4 },
  { source: 64, square: 8 },
  { source: 121, square: 11 }
]
Write a program in JavaScript
function getTheSquare(arrayOfObjects) {
return arrayOfObjects;
}
___

Create a free account to access the full topic