typeof
Used to check the type of a value. It works well for primitives.
Example:
typeof 5 gives "number"
typeof "hi" gives "string"
typeof true gives "boolean"
typeof undefined gives "undefined"
typeof null gives "object" which is a known JavaScript quirk
typeof function() {} gives "function"
Use it when you want to know if something is a primitive or a function.
instanceof
Used to check whether an object was created from a specific constructor.
Example:
[] instanceof Array gives true
[] instanceof Object gives true
new Date() instanceof Date gives true
{} instanceof Array gives false
Use it when you want to check the actual class or constructor of an object.
In short:
typeof is for value types.
instanceof is for object relationships.