fbpx
skip to content

Spread the word.

Share the link on social media.

Share
  • Facebook
Have an account? Sign In Now

Sign Up

Join us to discover alumni reviews, ratings, and feedback, or feel free to ask any questions you may have!

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

Sorry, you do not have permission to ask a question, You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

Analytics Jobs

Analytics Jobs Logo Analytics Jobs Logo
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Popular Course Rankings 2024
    • Best Data Science Course
    • Best Full Stack Developer Course
    • Best Product Management Courses
    • Best Data Analyst Course
    • Best UI UX Design Course
    • Best Web Designing Course
    • Best Cyber Security Course
    • Best Digital Marketing Course
    • Best Cloud Computing Courses
    • Best DevOps Course
    • Best Artificial Intelligence Course
    • Best Machine Learning Course
    • Best Front end-Development Courses
    • Best Back-end Development Courses
    • Best Mobile App Development Courses
    • Best Blockchain Development Courses
    • Best Game Designing/Development Courses
    • Best AR/VR Courses
  • Popular Career Tracks 2024
    • How to become a data scientist?
    • How to become a full stack developer?
    • how to become a product manager?
    • how to become a data analyst
    • how to become a ui ux designer
    • how to become a web designer?
    • how to become a cybersecurity professional?
    • how to become a digital marketing expert
    • how to become a cloud engineer?
    • how to become a DevOps engineer?
    • Career in artificial intelligence
    • how to become a machine learning engineer?
    • How to become a Front-end Developer
    • How to Become a Back-end Developer
    • How to become a mobile app developer?
  • Suggest Me a Course/Program
  • AJ Founders
  • Looking for Jobs?
    • Jobs in Data Science
    • Jobs in Javascript
    • Jobs in Python
    • Jobs in iOS
    • Jobs in Android

Analytics Jobs Latest Questions

Anonymous
Anonymous
Asked: February 7, 20242024-02-07T16:07:39+05:30 2024-02-07T16:07:39+05:30In: Data Science & AI

What is a non primitive data type in JavaScript?

What is a non primitive data type in JavaScript?

Recently, I was reading about JavaScript, and then I got the word non What does that mean? I really want to know more about it. Please help me with What is a non primitive data type in JavaScript?

#coding#programming
  • 1 1 Answer
  • 52 Views
  • 0 Followers
  • 0
    • Report
  • Share
    Share
    • Share on Facebook
    • Share on Twitter
    • Share on LinkedIn
    • Share on WhatsApp

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. AJ Mentor
    AJ Mentor Teacher
    2024-02-07T16:17:01+05:30Added an answer on February 7, 2024 at 4:17 pm

    Non primitive data types in JavaScript

    An overview of non primitive data types in JavaScript.

    Non primitive data types in JavaScript mean objects that can store and control data collections. Here is an overview of the popular non-primitive data types in JavaScript.

     

    What are the data types?

    Data types specify the kind of information a variable is holding so that the computer knows which computations can be done. Data types do not care exactly “what” the data is, but “how” it can be used.

    There are 7 primitive data types in JavaScript

    • string
    • number
    • BigInt
    • boolean
    • Symbol
    • undefined
    • null

    There is only one non primitive data type in JavaScript

    • object

     

    Identifying JavaScript Data Types Examples

    For any of the below values, you can use the type of operator to return the data type. Try it out yourself!

    const bookTitle = “The Great Gatsby”;

    console.log(typeof bookTitle) // string

    Non primitive data types in JavaScript

    Non primitive data types in JavaScript

    Primitive data types in javascript with Examples

    const automobileMake = ‘Honda’; // string

    const temperatureInDegrees = 78; // number

    const serialNumber = BigInt(83784639236484625) // bigint

    const isRunning = true; // boolean

    const typeOfSoda = Symbol(‘Pepsi’) // symbol

    const computerBrand; // undefined

    Let’s take a quick look at null.

    const dogBreed = null; // object

    The null data type will return as type object. Some places reference this as a bug built into JavaScript that cannot be fixed because it will break code that exists today. Other sources indicate that null is closely related to an object (similar to how NaN is related to number), so it was given the object type. Either way it is important to know that while this does return object, it is a Primitive data type.

    Non primitive data types in JavaScript with Examples

    const employee = {

      firstName: ‘John’,

      lastName: ‘Smith’,

      role: ‘developer’,

    }; // object

    const colors = [‘blue’, ‘green’, ‘purple’] // object

     

    Let’s understand, What is  Non Primitive Data Types in JavaScript?

    Stored on the Memory Heap

    A non-primitive data type is assigned an address as a value, which then creates a pointer to that address location in the memory heap.

    Mutable

    Non-primitive data types are mutable, which means when they are modified, the original copy is modified. Modifying these will not create a copy at a different address. Any direct modifications will effect the same address in the heap.

    const cup = {

      type: ‘plastic’,

      sizeInOunces: 12,

    };

     

    const mug = cup;

    mug.type = ‘glass’;

     

    console.log(cup) // { type: “glass”, sizeInOunces: 12 }

     

    Huh?! So what happened? Why, when we updated type of the mug object, was cup effected? This example shows mutability! Let’s take a look behind the scenes…

    1. cup is created in the call stack and is assigned an address.
    2. The value of cup does not contain the object above, it contains another address pointing to a location in the memory heap.
    3. The location in the memory heap contains the value of the cup object.
    4. mug is assigned the value of cup. Since the value of cup contains an address pointing to a location in the memory heap, mug will also point to that same location in the memory heap.
    5. Since these are both now pointing to the same location in the memory heap, any changes made to one will effect the other.

    Dynamically Sized

    Non-primitive data types can change in size. They can grow or shrink and hold multiple values.

    const birds = [‘quail’, ‘parrot’];

    birds.push(‘parakeet’);

    console.log(birds) // [‘quail’, ‘parrot’, ‘parakeet’]

     

    Complex Data Type

    Non-primitive data types can be broken down into simpler data types.

    Refer to the example under the section “Simple Data Type” of primitive values for an example of this.

    Methods

    Since non-primitive data types are objects, we can make use of JavaScripts built in methods to simplify our development. We can also create our own object methods by creating an object and assigning a function definition to a property.

    Built-in method

    const numbers = [1, 2, 3, 4, 5, 6, 7, 8, 9];

    const reversedNumbers = numbers.reverse();

    console.log(reversedNumbers); // [9, 8, 7, 6, 5, 4, 3, 2, 1]

     

    Custom method

    const dog = {

      name: ‘Jo’,

      breed: ‘poodle’,

      color: ‘white’,

      getInformation: function() {

        return ‘Name: ‘ + this.name + ‘, Breed: ‘ + this.breed + ‘, Color: ‘ + this.color;

      }

    }

    console.log(dog.getInformation()) // “Name: Jo, Breed: poodle, Color: white”

     

     

    Let’s do a quick recap of non primitive data types in JavaScript

    Primitive Data Types in javascript

    • 7 total in JavaScript
    • Stored on the call stack
    • Immutable – will be made new in the call stack, never overwrites.
    • Cannot grow or expand in size
    • Cannot be broken down into a simpler data type
    • Cannot use methods (but also remember… autoboxing!)

    Non Primitive Data Types in Javascript

    • 1 total in JavaScript
    • Stored in the memory heap
    • Mutable – will be modified in the memory heap and overwritten.
    • Can grow or expand in size
    • Can be broken down into a simpler data type
    • Can use methods

     

    • 0
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Suggest Me a Course
top-10-data-science-machine-learning-institutes-in-india-ranking 2024
top-30-companies-in-india-to-work-for-in-data-science-and-machine-learning
data-science-b-tech-colleges-in-india
  • Popular
  • Answers
  • Subhash Kumar

    Henry Harvin Reviews - Career Tracks, Courses, Learning Mode, Fee, ...

    • 83 Answers
  • Analytics Jobs

    Scaler Academy Reviews – Career Tracks, Courses, Learning Mode, Fee, ...

    • 44 Answers
  • Analytics Jobs

    UpGrad Reviews - Career Tracks, Courses, Learning Mode, Fee, Reviews, ...

    • 42 Answers
  • jasmeen
    jasmeen added an answer I enrolled in the Data Science course at Digicrome Academy,… July 15, 2025 at 2:01 pm
  • Anshul Mts
    Anshul Mts added an answer My involvement with the InGrade Data Science course is very… July 4, 2025 at 2:26 pm
  • Priyam Garg
    Priyam Garg added an answer I would feel glad to share my honest review of… July 3, 2025 at 2:15 pm

Related Questions

  • University of Richmond Boot Camps Reviews - Career Tracks, Courses, ...

    • 0 Answers
  • NYC Data Science Academy Reviews - Career Tracks, Courses, Learning ...

    • 0 Answers
  • Science to Data Science Reviews - Career Tracks, Courses, Learning ...

    • 0 Answers
  • iO Academy Reviews - Career Tracks, Courses, Learning Mode, Fee, ...

    • 0 Answers
  • Zaka Reviews - Career Tracks, Courses, Learning Mode, Fee, Reviews, ...

    • 0 Answers

Category

  • Accounting and Finance
  • AJ Finance
  • AJ Tech
  • Banking
  • Big Data
  • Blockchain
  • Blog
  • Business
  • Cloud Computing
  • Coding
  • Coding / Development
  • Course Review & Ranking
  • Cyber Security
  • Data Science & AI
  • Data Science, Artificial Intelligence, Analytics
  • DevOps
  • Digital Marketing
  • Grow My Business
  • Leadership
  • My StartUp Story
  • Product Management
  • Robotic Process Automation (RPA)
  • Software Testing
  • Start My Business
  • Wealth Management

Explore

  • Popular Course Rankings 2024
    • Best Data Science Course
    • Best Full Stack Developer Course
    • Best Product Management Courses
    • Best Data Analyst Course
    • Best UI UX Design Course
    • Best Web Designing Course
    • Best Cyber Security Course
    • Best Digital Marketing Course
    • Best Cloud Computing Courses
    • Best DevOps Course
    • Best Artificial Intelligence Course
    • Best Machine Learning Course
    • Best Front end-Development Courses
    • Best Back-end Development Courses
    • Best Mobile App Development Courses
    • Best Blockchain Development Courses
    • Best Game Designing/Development Courses
    • Best AR/VR Courses
  • Popular Career Tracks 2024
    • How to become a data scientist?
    • How to become a full stack developer?
    • how to become a product manager?
    • how to become a data analyst
    • how to become a ui ux designer
    • how to become a web designer?
    • how to become a cybersecurity professional?
    • how to become a digital marketing expert
    • how to become a cloud engineer?
    • how to become a DevOps engineer?
    • Career in artificial intelligence
    • how to become a machine learning engineer?
    • How to become a Front-end Developer
    • How to Become a Back-end Developer
    • How to become a mobile app developer?
  • Suggest Me a Course/Program
  • AJ Founders
  • Looking for Jobs?
    • Jobs in Data Science
    • Jobs in Javascript
    • Jobs in Python
    • Jobs in iOS
    • Jobs in Android
aalan

Footer

Social media

About Analytics Jobs

  • About Us
  • Videos
  • FAQs
  • Careers
  • Contact Us
  • Press
  • Sitemap

Our Services

  • Advertise with us
  • Upcoming Awards & Rankings
  • Write for us

Our Brands

  • AJ Founders
  • Aj Tech
  • AJ Finance
  • AJ Entertainment

Terms

  • Terms of Use
  • Privacy Policy
  • Disclaimer

Footer 1

Copyright © , Analytics Jobs. All right reserved.

Get Free Career
Counselling from
Experts

Book a Session with an
Industry Professional today!
By continuing you agree to our Terms of Service and Privacy Policy, and you consent to receive offers and opportunities from the Analytics Jobs platform listed EdTech’s by telephone, text message, and email.