List few difference between primitive and non primitive JavaScript data types?

devquora
devquora

Posted On: Feb 22, 2018

 

    1 Answer Written

  •  devquora
    Answered by Satyam

    Difference between Primitive and Non-Primitive data types in Javascript.

    Primitive: Primitive Data Type is a type of data in Java which is simple in nature and is suitable for the base architecture of all the operations of computer like int, float, pointer, etc. and also all the possible variations of them such as char, short, long, signed, unsigned, float double, etc. They are not able to possess additional capabilities. Moreover, they are only single values and not the complex ones. Some of the examples of primitive data types can be given by byte, short, int, long, float, double, char and many more. There are some primitive data structures in the library too.

    Some of the primitive data structures consist of integer reals, logic data character, pointer, reference, etc. Both primitive data types as well as primitive data structures can be directly controlled and monitored by the machine-level instructions and therefore called the simplest forms of data types and data structures. Primitive data are built-in or it can be said that they are already defined data types. In the world of programming, whenever data type is considered it automatically reflects the primitive data type, not the non-primitive one.

    Non Primitive: A non-primitive data type is quite different from that of the primitive data type. It comprises of an array structure or class inside the program. These data types are formed by deriving from primary data types. These commonly consist of a group of values. Some examples of non-primitive data types are array, structure, union, linked lists, stacks, queues, etc. Non-primitive data types are based on class. Another name for these kinds of data types is reference data types or object references.

    These cannot be defined using a programming language but in the place of it, the programmer himself defines non-primitive data types. In Java, these are simply known as objects because they are created by the user, not predefined in the library. Non-primitive data types represent a memory location which gives space to store the data. Also, when an object (non-primitive data type) is created, it may contain any type of data, but the information represented by the object will always be stored as a primitive data type.

Related Questions

Please Login or Register to leave a response.

Related Questions

JavaScript Interview Questions

Explain what is Javascript?

JavaScript, a dynamic, client-side language, is crucial in modern web development, working alongside HTML and CSS. Its manipulation of the Document Object Model (DOM) enables dynamic content and inter..

JavaScript Interview Questions

What close() does in Javascript?

In JavaScript, the close() method is employed to securely close the current window. To ensure its association with the window object rather than another JavaScript object, employ window.close(). This ..

JavaScript Interview Questions

What is the difference between let and var?

Both var and let are utilized for variable/method declaration in JavaScript. The crucial disparity lies in their scope: var is function-scoped, meaning it's accessible throughout the function it's def..