7. return error. It looks like you didn't print out the value of newNumber


#1

This is my code:
// Parameter is a number, and we do math with that parameter
var timesTwo = function(number) {
return number * 2;
};

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

obviously im missing something very obvious


#2

see how you did

timesTwo(8);

all you have to do is store this call to that method in newNumber

var newNumber = timesTwo(8);

then finally you can do

console.log(newNumber);

#3

OK , thanks it worked!!


#4

I have been trying it but its not working. Here is my code:

  1. // Parameter is a number, and we do math with that parameter
  2. var timesTwo = function(number) {
  3. return number * 2;
  4. };
  5. timesTwo(8);
  6. var newNumber = timesTwo(5);
  7. console.log(newNumber);

I keep getting error thta I didn't print out the value of the newNumber. Am I missing syntax? Im not sure what I am doing wrong here.


#5

Seem to be ok but why do you use this timesTwo(8) (when it's result is never used)?


#6

/ Parameter is a number, and we do math with that parameter
var timesTwo = function(number) {
    return number * 2;
};

// Call timesTwo here!
var newNumber = function( timesTwo) 
{ console.log( newNumber); };
    timesTwo(8)

i do not know were i am going wrong!!!!


#7

i think U must change your code:
var newNumber = function( timesTwo)
{ console.log( newNumber); };
timesTwo(8)
from
timesTwo(8);
var newNumber = timesTwo(8)
console.log(newNumber);


#8

You don't even need the timesTwo(8); this should already be sufficient:

var newNumber = timesTwo(8)
console.log(newNumber);

It's just about seeing how return works. So play around with it a bit enter different values run it multiple times aso.


#9

never mind year, bye d way can i know about u


#10

and how much have u done i am stuck @ 34%


#11

What is wrong

// 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);
{console.log(newNumber);
};
timesTwo(8);


#12

This is what I put in:

// Parameter is a number, and we do math with that parameter
var timesTwo = function(number) {
return number * 2;
};

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

but I get error saying function expected and codecademy is asking if I set var newNumber = timesTwo(n).
This should work and log 20 to the console, but it just doesn't!

Thanks for any help.


#13

I have done as you have written above but it still shows that there's is a problem with my syntax!

This is my code:

// Parameter is a number, and we do math with that parameter
var timesTwo = function(number) {
return number * 2;
};
timesTwo(8);
var newNumber = timesTwo(8); {
console.log(newNumber);
};


#14

dont use this "{ }" on line 7 until 9 !!