This is an old revision of the document!


javascript

Functions in javascript can be named or anonymous. They have access to local variables that are in the scope of their parent functions.

    function fun2(){
        var output = ""
        if(typeof myGlobal != "undefined"){
            output += "myGlobal: " + myGlobal;
        }
        if(typeof oopsGlobal != "undefined"){
            output += " oopsGlobal: " + oopsGlobal;
        }
        console.log(output)
    }

These are defined with the following syntax:

var person = {
    firstName : "Jack",
    lastName : "Smith",
    age : 19,
    employed : true
}
  • javascript.1600833383.txt.gz
  • Last modified: 2020/09/23 03:56
  • by paul