Method used on Primitive Type
const str = 'foo'console.log(typeof str) // stringconsole.log(str.length) // 3
We should see an error when we try to use a 'dot' method on a string right? By rule, Primitive Types don't have any properties or methods on them. But as seen above, str.length returns a number, which means we just used a method on a string. 🧐
When a Primitive Type is wrapped, it will connect that Type with a built-in object prototype that corresponds with the Primitive Type. This is where you get string.length, string.includes, or string.toUpperCase. (Methods documented on MDN web docs).