Global vs Local variables please help


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: ");

this is my code help meeeeeeeee pleaseeeeeeee


What is the problem?


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