• Monday , 25 May 2020

JavaScript Tutorial Part 4 – Primitives

Code Canyon



JavaScript Tutorial For Beginners

Learning Curve Books: http://www.learningcurvebook.net
Follow on Twitter: https://twitter.com/js_tut
Instagram: https://www.instagram.com/javascriptteacher
Facebook: https://www.facebook.com/javascriptteacher

There are 7 primitive data types in JavaScript (object may or may not be a primitive per se, but it is often used in the discussion of primitive data types in JavaScript.) EcmaScript6 adds a new primitive data type called Symbol.

var a = undefined;
console.log(typeof(a)); // “undefined”

a = “Hello there.”;
console.log(typeof(a)); // “string”
console.log(a.valueOf()); // “Hello there.”

a = 75;
console.log(typeof(a)); // “number”
console.log(a.valueOf()); // 75

a = true;
console.log(typeof(a)); // “boolean”

a = null;
console.log(typeof(a)); // “object” (“null”-object)

a = {a:1}; // object literal
console.log(typeof(a)); // “object”

a = Symbol(); // EcmaScript6
console.log(typeof(a)); // “symbol”

Probably related keywords:
JavaScript primitives / primitive types / javascript primitive types and reference types / primitive data type / primitive data types / JavaScript primitive types vs objects

Self-education + Computer Literacy
For next generation of teachers,
artists, coders, designers, and makers of things:
Learning Curve Books: http://www.learningcurvebook.net

Original source

3d Ocean

Related Posts

4 Comments

  1. ITNEXT
    June 15, 2019 at 19:10

    Cool!

  2. nikhil ponduri
    June 15, 2019 at 19:10

    Really awesome

  3. artie63
    June 15, 2019 at 19:10

    Thanks so much for the tutorials, keep up the good work!

  4. Sergio Martín
    June 15, 2019 at 19:10

    I enjoyed it a lot.
    Thanks a million !

Leave A Comment

You must be logged in to post a comment.