Pilcrow Records

Scripter Javascript Tutorial

javascriptmusiclogicscripterbookexcerpttutorial

34 typeof comparison

MDN: Operators: typeof

typeof returns true if a variable’s value is a particular data type and uses strings for its returned values.

var str = "foobar";
if ( typeof str == "string" ) {
	Trace(str); // "string"
}
var num = 60;
Trace(typeof num); // "number"

In the above example: