Global vs Local variables please help


#1

var my_number = 7; //this has global scope

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

this is my code help meeeeeeeee pleaseeeeeeee


#2

What is the problem?


#3

if you want to print something,firstly you should call the timesTwo function;secondly ,inside the function,you rename a variable my_number using var,so the my_number in the function is a local variable,the console.log() is print the number*2;
if you call console.log(my_number),it will print the global variable my_number:7