I used to think that both assignments a = "foo" and a = new String('foo') are the same things. But with the former declaration, console.log(a instanceof Object) or console.log(a instanceof String) returns false, while it returns the expected true for the latter.
This seems weird for two reasons. Firstly, even with the normal declaration a = 'foo', all string methods work on it, suggesting that it has inherited from String object. And secondly, a.constructor returns String.
Can anybody explain what's going on?