updated by JMH on September 19, 2009 at 7:09 PM
updated by JMH on October 4, 2015 at 11:55 AM
updated by JMH on May 19, 2023 at 8:19 PM
Function definition:
function test( a, b, c )
or
var test = function( a, b, c )
Executing JavaScript function call:
test( 1, "one" ) ;
Results:
Referencing parameter a returns 1
Referencing parameter b returns one
Referencing parameter c returns undefined
c == null
returns true
c === null
returns false
c == undefined
returns true
because undefined
is a built-in VALUEc === undefined
returns true
c == "undefined"
returns false
because undefined
is NOT a STRINGc === "undefined"
returns false
Testing typeof
as an operator:
typeof c
returns undefined
as a STRINGtypeof c == "undefined"
returns true
typeof c === "undefined"
returns true
typeof c == undefined
returns false
because typeof
returns a STRINGtypeof c === undefined
returns false
Testing typeof
as a function:
typeof( c )
returns undefined
as a STRINGtypeof( c ) == "undefined"
returns true
typeof( c ) === "undefined"
returns true
typeof( c ) == undefined
returns false
because typeof(...)
returns a STRINGtypeof( c ) === undefined
returns false