I am getting back into web development, and have been trying to go over the nuances of jscript recently. I was pouring through the source of the THREEx extension library built on top of Three.JS and noticed this function
THREEx.KeyboardState.prototype.pressed = function(keyDesc)
{
var keys = keyDesc.split("+");
for(var i = 0; i < keys.length; i++){
var key = keys[i];
var pressed;
if( THREEx.KeyboardState.MODIFIERS.indexOf( key ) !== -1 ){
pressed = this.modifiers[key];
}else if( Object.keys(THREEx.KeyboardState.ALIAS).indexOf( key ) != -1 ){
pressed = this.keyCodes[ THREEx.KeyboardState.ALIAS[key] ];
}else {
pressed = this.keyCodes[key.toUpperCase().charCodeAt(0)];
}
if( !pressed) return false;
};
return true;
}
I am looking in particular at the line here:
if( THREEx.KeyboardState.MODIFIERS.indexOf( key ) !== -1 ){
I am not familiar with this !== operator. I checked w3schools and their logical operators list does not have this one included. I am not sure if this is misspelled and the browsers simply count it as != or if it has some other meaning. Also I was wondering whether this is actually a single logical operator or whether it is some kind of combination, like ! + ==?