Types in Javascript Flashcards
What is Static and Dynamically Typed?
Typescript is a statically typed language, which will be compiled into javascript.
Fewer bugs and fails and compile time.
Different Types in Javascript?
Numbers : 5
Boolean: true
String: “To be or not to be”
Object : {}
undefined
null
Symbol
What is type of?
Type of show the type of the data
What is type of null?
Object
What is type of array and function?
Object
What is difference between undefined and null?
Undefined is absence of the definition.
Null is absence of the value.
What are primitive type and non-primitive types?
Primitive types are absolutely which contain the same value
Non-primitive is something like function and array which is a type of object.
What is Array.isArray()?
Used to check it has array in js
Pass by reference vs pass by value?
Object and array is used as reference.
To copy object or array we can use spread operators. Object.assign({}, obj).
Variables are passed as values.
How to copy object and array?
To copy an object or array, we can use spread operators.
JSON stringify to parse.
Object.assign({}, obj).
What is type coercion?
Acting as a different variable.
1 == ‘1’ // true
1 === ‘1’ // false
Do all languages have type coercion?
Yes, because everything is converting to binary at the end.
Is it every-time you are using === instead of == ?
It’s not mandatory but recommended.