Return keyword syntax error missing formal paramater


introductions to functions/ 7.return keyword

it says syntax error missing formal parameter

var timesTwo=function(4) {
return number  *  2 ;
var newNumber=timesTwo(8);


@jhwhite05 your function statement at the beginning is the cause of the error. It should be
var timesTwo = function(Number).
while we are defining a function in javascript we need to give a variable as a formal parameter and not the value of the variable.
Hope this helped and mark this as a solution if satisfied :smile:

Here check my code for reference:
// Parameter is a number, and we do math with that parameter
var timesTwo = function(number)
return number * 2;

// Call timesTwo here!
var newNumber = timesTwo(8);


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.