Worker IS of type function. You can check that using the typeof operator. However, it does not inherit the prototype of the Function constructor, hence it is not an instanceof Function.
Here's a more practical example:
function fun(){}; Function.prototype.foo = 'my custom Function prototype property value'; console.log(fun.foo); //my custom Function prototype property value console.log(fun instanceof Function); //true console.log(typeof Worker); //function, the constructor console.log(Worker.foo); //undefined, this host constructor does not inherit the Function prototype console.log(Worker instanceof Function); //false var worker = new Worker('test.js'); console.log(typeof worker); //object, the instance console.log(worker.foo); //undefined, instance object does not inherit the Function prototype console.log(worker instanceof Function); //false
From MDN:
The instanceof operator tests whether an object has in its prototype chain the prototype property of a constructor.
Worker does not inherit the Function constructor's prototype, hence it is not an instance of Function.
Here's an example using the typeof operator to check if the user's browser supports the Web Workers API:
if (typeof window.Worker !== 'undefined') { alert('Your browser supports Web Workers!'); } else { alert('Sorry, but no.'); //too lazy to write a proper message for IE users }
Fiddle
Workerinterface as a native ECMAScript function. However, the trend in modern web-browsers is to implement more and more interfaces as native ECMAScript object types. Btw, in my Firefox (latest, on Windows),Worker instanceof Functiondoes evaluate totrue.