Let’s look at the solution for each task one by one.
Task 1
We passed parameters and assigned them to their corresponding properties.
Task 2
We calculated the squares of the properties by multiplying them with itself and stored them in a variable.
Then, we added all the squared numbers.
Finally, we returned their sum.