Working with Primitive Types

Share this video with your friends

Send Tweet

Everything within JavaScript is not actually an object. There are many primitive types that are not objects and are used everyday by developers. A primitive value represents the lowest level of the language implementation. We'll review what are considered primitive types in JavaScript today and how primitive types are treated differently than objects.

Michael
Michael
~ 5 years ago

Hi, Don't get the last example.

let a = 1

function add(b) { a = b }

add(2)

console.log(a)// is 2, not one since a is global.

The reason you get another is that you override num as a parameter right, is that what you mean? This will however be the same as an object.

Thanks

Hafeez Syed
Hafeez Syed
~ 5 years ago

hey Tyler, I know this is off topic. Are you using wallaby.js? If yes, then would you mind sharing the configuraiton?

Thanks

Tyler Clark
Tyler Clark(instructor)
~ 5 years ago

Are you using wallaby.js

Yes, it is the paid version for VS code found here: https://quokkajs.com/docs/index.html

Hafeez Syed
Hafeez Syed
~ 5 years ago

Thanks Tyler :)

I have both Wallaby & Quokka pro but somehow it wasn't running.

But I did make that work now

Matt
Matt
~ 5 years ago

Anyone know why console.log(typeof class MyClass {}) == function

Will Johnson
Will Johnson
~ 5 years ago

Anyone know why console.log(typeof class MyClass {}) == function

Yes Matt, classes in JavaScript are "special functions"

Here is more information: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes