Skip to content
Advertisement

Is it possible to define new data types in JavaScript?

MDN says there are nine data types in latest JS spec. I wondering if these are the only nine data types that the spec allows programmers to use.

Just to clarify, I think programmer-defined functions/constructors internally using prototypical inheritance are still Objects, so do not qualify as new data types.

Advertisement

Answer

There is no facility that allows defining custom core data types in JavaScript. You can only use them and objects to construct what you want.

User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement