Answers for "change a variable outside a function js"

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 "change a variable outside a function js"

Code answers related to "Javascript"

Browse Popular Code Answers by Language