Pilcrow Records

Scripter Javascript Tutorial

javascriptmusiclogicscripterbookexcerpttutorial

33 instanceof comparison

MDN: Operators: instanceof

The instanceof comparison returns true if an object is an instance of a particular object type.

function HandleMIDI(event) {
	if ( event instanceof NoteOn ) {
		Trace("NoteOn");
	}
}

In the above example: