Differences between typeof and instanceof in JavaScript

I’m working with node.js, so this could be specific to V8. I’ve always noticed some weirdness with differences between typeof and instanceof, but here is one that really bugs me: var foo = 'foo'; console.log(typeof foo); Output: "string" console.log(foo instanceof String); Output: false What’s going on there? Answers: Thank you for visiting the Q&A section … Read more