Javascript Flashcards

1
Q

Difference between let and var?

A

var is functionally scoped while let is block scoped

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

What are closures in JS?

A

closure gives you access to an outer functions scope from an inner function. Closures are created every time a function is created.

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

What is OOP?

A

Object-Oriented programming uses objects that can be considered as real-world instances of entities like class

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

What are the main features of OOP?

A

Inheritance
Encapsulation
Polymorphism
Data Abstraction

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

What is a class?

A

A class is a blueprint which contains values and some set of rules. When an object is created with a class it automatically takes the data and functions

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

What is an object?

A

Refers to the instance of a class

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

What is encapsulation?

A

All necessary data and methods are bound together and all the unnecessary details are hidden to the normal user.

Data Hiding: encapsulation hides unwanted information
Data Binding: encapsulation is the process of binding the data members and the methods together as a whole as a class

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

What is Polymorphism?

A

the process by which some code, data, method or object behaves differently under different circumstances or contexts.

Two Types: Compile-time and run time

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

Compile-Time Polymorphism vs Run-Time

A

Compile-Time: refers to the type of polymorphism that happens at compile time. Also known as static

Run-Time: happens at run time, it can’t be decided by the compiler, shape or value depends on the execution. Also known as dynamic

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

What is Inheritance?

A

receiving some quality or behavior from a parent to an offspring, when a class is created using the definition of another object or class (parent).

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

What is Abstraction?

A

Hiding unnecessary details from the necessary ones.

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

How much memory does a class occupy?

A

None.

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

What is a constructor?

A

constructors initialize the objects.

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

Define a superclass?

A

A part of inheritance, allows subclasses or child classes to inherit from itself.

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

What is binding?

A

creates a new function that when called, sets this to the provided value

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