13. 13 Function review


Jeez, I am stuck at 13. I am not the best at parameters.

My error message is: SyntaxError: missing ) after formal parameters
my code is below

// Accepts a number x as input and returns its square
var square = function (x) {
  return x * x;

// Write the function multiply below
// It should take two parameters and return the product
var multiply = function (y, square(2)){
    return square * y;


Remove the (2) in the function multiply and then call the function at the end of the code.

Hope that helps.


Now I get this
SyntaxError: missing before statement
I have removed the (2) on the square and put the (2) at the end like this

var multiply = function (y, square) (2){
    return square * y;


When I ran your first code I got: SyntaxError: Unexpected token (

I removed the (2) completely an then I added multiply(); at the bottom.

var multiply = function (y, square){
return square * y;

That worked for me.


It worked, but I doesn't feel right, it says just NULL, but it worked, so, THAT'S GOOD! Thanks!


Yes it didn't feel right to me either, but hey if it works then it works. :smile:


I'm new at JavaScript but I don't think you are suposed to insert the square function in the multiply function at all.


var multiply = function(x, y) {
return x * y;


simplest is to do

var multiply = function(x, y) {
return x * y;

but it's never wrong to put more stuff


I have the same, didn't add the last line, it said got to call multiply at least once,
(thanks btw) I don't think its meant to be that complicated.