Section 3: Types and Operators Flashcards
Dynamic Typing
You don´t tell the engine what type of data a variable holds, it figures it out while your code is running. Variables can hold different types of values because it`s all figured out during execution
What keyword exist to tell the engine what kind of data you intend to put inside a variable?
There is NO keyword
What is a primitive Type?
A type of data that represents a single value
An object is a primitive type?, and why?
not, because an object is a collection of name / value pairs
How many primitive types exist in JS
6 primitive types
Name the 6 primitive types in JS
undefined
null
boolean
number
string
symbol
Describe the primitive type: Undefined
Represents lack of existence, its what the JS engine sets variables to initially and it will stay undefined unless you set the variable to have a value.
Describe the primitive type: Null
and when its useful
represents lack of existence (you can set a variable to this).
its useful when you want to represent that something doesn´t exist, that the variable has no value(set a variable to nothing).
Describe the primitive type: Boolean
Either true or false, just one of two values
Describe the primitive type: Number
Exist other numeric types in JS?
There’s only one numeric type.
Its a floating poing number (there
s always some decimals)
Describe the primitive type: String
What we use to define a string?
A sequence of characters (both ‘’ and “” can be used)
Describe the primitive type: Symbol
It`s defined in ES6
What is an operator?
It`s a special function that is syntactically (written) differently. Generally operators take 2 parameters and return one result.
How did the JS engine that this was my intent to add 3 and 4?
var a = 3 + 4;
console.log(a); // result: 7
The syntax parser saw the plus(+) sign and added these 2 numbers.The plus sign is an operator, it’s actually a function.
What is the name of the notation that the JS engine provide to deal with operators.
Inflix notation