Answers for "in order to change the value of global variable inside function, keyword global is used"

0

change a variable outside a function js

var global = "Global Variable"; //Define global variable outside of function

function setGlobal(){
       global = "Hello World!";
};
setGlobal();
console.log(global); //This will print out "Hello World"
Posted by: Guest on September-12-2020

Code answers related to "in order to change the value of global variable inside function, keyword global is used"

Code answers related to "Javascript"

Browse Popular Code Answers by Language