Pls help, how do i print the new number


#1


var timesTwo = function(number) {
    return number * 2;
};

// Call timesTwo here!
var newNumber = timesTwo("8"); 
console.log(newNumber);


#2

Your code does that.


#3

@cpt_dan ,

Did you get a result other than what you expected?

(Edited November 21, 2016 to add the following, after some testing)

For Exercise 7: Return keyword, the instructions ask you to do this ...

On line 7, after the equals sign, call the function timesTwo with any parameter you want

Unfortunately, the submission correctness test (SCT) will not accept your submission if you pass the function a string that can be converted to a number. So this is not accepted ...

var newNumber = timesTwo("8");

It will accept this or another number as an argument ....

var newNumber = timesTwo(8);

It will also accept the following, or the passing of another string as an argument, provided that the string cannot be converted to a number ...

var newNumber = timesTwo("Hello World!");

One more test ...

var newNumber = timesTwo(NaN);

Yes, it accepts that as well.


#4

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