Answers for "function scope"

29

javascript define global variable

window.myGlobalVariable = "I am totally a global Var"; //define a global variable
var myOtherGlobalVariable="I too am global as long as I'm outside a function";
Posted by: Guest on August-02-2019
1

global scope js

const color = 'blue'

const returnSkyColor = () => {
  return color; // blue 
};

console.log(returnSkyColor()); // blue
Posted by: Guest on July-05-2020
0

function scope

// code here can NOT use carName

function myFunction() {

  var carName = "Volvo";
  // code here CAN use carName
}

  
// code here can NOT use carName
Posted by: Guest on May-07-2021

Browse Popular Code Answers by Language