Variables & Primitives vs Non-primitive

Variables & Primitives vs Non-primitive

PRIMITIVE VS NON -PRIMITIVE

  • PRIMITIVES ARE COPIED BY THEIR VALUE

  • REFERENCE(non-primitive) ARE COPIED BY THEIR ADRESS/REFERENCES

  • primitive value types => string , number, boolean, undefined, null

  • non-primitive(reference type) types => array ,object ,function ==> here all are objects

  • what is the difference between them

Variable name convention Rules :

  • The first character must be a letter or an underscore ( - ) or an dollar ( $ ) . You can't use a number as the first character .

  • The rest of the variable name can include any letter , any number , or the underscore . Can't use any other characters , including spaces .

  • Variable names are case sensitive . No limit to the length of the variable name .

  • You can't use one of JavaScript's reserved words as a variable name

  • we cant use special character in name

  • Datatypes in Javascript

    Six Data Types that are primitives

    • Boolean : typeof instance === " boolean "

    • undefined : typeof instance === " undefined "

    • Number : typeof instance === " number "

    • String : typeof instance === " string "

    • BigInt : typeof instance === " bigint "

    • Symbol : typeof instance === " symbol "