I'm stuck!lesson 10 functions JS


#1

What's wrong with this?JS lesson 10

var my_number = 7;

var timesTwo = function(number) {
my_number = number * 2;
console.log("Inside the function my_number is: ");
var my_number = 19;
console.log(my_number);
};

console.log("Outside the function my_number is: ")
timesTwo(7)
console.log(my_number)


#2

This line shouldn't be here. That is what is posing an error.


#3

Also missing semi colons


#4

Thank you so much`


#5

Wait it still is not working!


#6

paste in your updated code


#7

var my_number = 7;

var timesTwo = function(number) {
my_number = number * 2;
console.log("Inside the function my_number is: ");
console.log(my_number);
};

console.log("Outside the function my_number is: ");
timesTwo(7);
console.log(my_number);


#8

this needs to be a variable so:

var my_number = number * 2;

#9

Call this line,

before this one

Control Flow. :grin:


#10

Thanks so much!!!!!!!


#11

You're welcome? :hushed: :laughing:


#12

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