Javascript Flashcards
Difference between let and var?
var is functionally scoped while let is block scoped
What are closures in JS?
closure gives you access to an outer functions scope from an inner function. Closures are created every time a function is created.
What is OOP?
Object-Oriented programming uses objects that can be considered as real-world instances of entities like class
What are the main features of OOP?
Inheritance
Encapsulation
Polymorphism
Data Abstraction
What is a class?
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
What is an object?
Refers to the instance of a class
What is encapsulation?
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
What is Polymorphism?
the process by which some code, data, method or object behaves differently under different circumstances or contexts.
Two Types: Compile-time and run time
Compile-Time Polymorphism vs Run-Time
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
What is Inheritance?
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).
What is Abstraction?
Hiding unnecessary details from the necessary ones.
How much memory does a class occupy?
None.
What is a constructor?
constructors initialize the objects.
Define a superclass?
A part of inheritance, allows subclasses or child classes to inherit from itself.
What is binding?
creates a new function that when called, sets this to the provided value