Advertisement
728x90
In ES5, it will throw a TypeError exception if the obj parameter isn't an object. Whereas in ES2015, the parameter will be coerced to an Object.
javascript
1// ES5
2
3Object.getPrototypeOf("James"); // TypeError: "James" is not an object
4// ES2015
5
6Object.getPrototypeOf("James"); // String.prototypeAdvertisement
Responsive Ad
🎯 Practice NowRelated Challenge
JavaScript Coding Exercise 3
Test your knowledge with this interactive coding challenge.
Start CodingAdvertisement
728x90
260of476