Types in Javascript Flashcards

1
Q

What is Static and Dynamically Typed?

A

Typescript is a statically typed language, which will be compiled into javascript.
Fewer bugs and fails and compile time.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Different Types in Javascript?

A

Numbers : 5
Boolean: true
String: “To be or not to be”
Object : {}
undefined
null
Symbol

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What is type of?

A

Type of show the type of the data

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What is type of null?

A

Object

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What is type of array and function?

A

Object

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What is difference between undefined and null?

A

Undefined is absence of the definition.
Null is absence of the value.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What are primitive type and non-primitive types?

A

Primitive types are absolutely which contain the same value
Non-primitive is something like function and array which is a type of object.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What is Array.isArray()?

A

Used to check it has array in js

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Pass by reference vs pass by value?

A

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 well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

How to copy object and array?

A

To copy an object or array, we can use spread operators.
JSON stringify to parse.
Object.assign({}, obj).

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

What is type coercion?

A

Acting as a different variable.

1 == ‘1’ // true
1 === ‘1’ // false

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Do all languages have type coercion?

A

Yes, because everything is converting to binary at the end.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

Is it every-time you are using === instead of == ?

A

It’s not mandatory but recommended.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly