javascript ECMCA Interview Q
javascript ECMCA Interview Q
INTERVIEW GUIDE
What is ECMA Script
ECMA stands for "European Computer Manufacturers Association."
This organisation provides standard javascript for different Browsers.
● ES6 allows you to make the code more modern and raladable .
● By using ES6 features we write less ad do more “ write less, do
more ”
The let and const variables were introduced in JavaScript with the
ECMAScript 2015 (ES6) specification and both have Block-Level Scope.
var:
let:
2
3
Key Differences:
4
2. Hoisting in JavaScript ?
Hoisting in JavaScript means that when you declare variables or
functions, JavaScript moves their declarations to the top of the scope
before the code actually runs. However, only the declarations are
hoisted, not the initializations.
callback
With let , each iteration of the loop has a separate i value, so the
setTimeout callback will log the correct i value for each iteration.
7
5. Template Literals in JavaScript ?
Template literals in JavaScript, introduced with ECMAScript 2015 (ES6),
provide a way that you can concat variable with strings .
Template literals use backticks (`) instead of single quotes (') or double
quotes (").
Summar y:
11
2.this Binding:
1. ClassDeclaration:
○ Theclasskeywordisusedtodefineaclass.
○ Aclassbodycontainsmethodsandaspecialmethodcalled
constructor.
2. ConstructorMethod:
○ Theconstructormethodisaspecialmethodthatiscalledwhen
an instance of the class is created.
13
3 . Methods:
● Methodsaredefinedinsidetheclassbodyand itsuserdefinedfunction
is also called prototype function.
4 . Static Methods:
● Staticmethodsarecalledontheclassitself,notoninstancesofthe
class. They are defined using the static keyword.
14
5. Inheritance:
● Classes can extend other classes using the extends keyword. The
child class inherits methods and properties from the parent class.
● Thesuperkeywordisusedtocallmethodsandconstructorsfrom
the parent class.
● Wecansuper()mathedinsidethechildclassconstructor.
7. Getters and Setters:
● Getters and setters allow you to define methods that get or set
the values of properties. They are defined using the get and set
keywords
16
Summar y.
17
18
1.Function Parameters:
19
In this example, the ...numbers parameter collects all the arguments passed
to the sum function into thenumbers array.
2. Destructuring
Arrays:
● Therestoperatorcanbeusedtocollecttheremainingelementsofan
array into a new array during destructuring.
● Itisallowsyoutounpackvaluesfromarraysorpropertiesfromobjects
into distinct variables.
3. Destructuring Objects:
● Therestoperatorcanbeusedtocollecttheremainingpropertiesofan
object into a new object during destructuring.
6 . Spread Operator in JavaScript ?
In this example, ...fruits spreads the elements of the fruits array into the
moreFruits array.
21
Key Concepts :
1. States of a Promise:
● Pending:Theinitialstateofapromise.Thepromiseisneitherfulfilled
nor rejected.
● Fulfilled: The state of a promise when the asynchronous operation is
completed successfully.
● Rejected: The state of a promise when22the asynchronous operation
fails.
2.Promise Object:
● ThePromiseobjecthasmethodstohandleasynchronousresults:
then(), catch(), and finally().
Handling Multiple Promises:
23
Summar y
25
9 . Global Function in JavaScript ?
Global functions are functions that are available globally, meaning they
can be accessed and invoked from anywhere in your code.
isFinite()
isNaN()
27
11 . Deep Copy and Shallow Copy JavaScript ?
when we copy one object to another object in this case object data is
not copied object reference is copied in this case we can used :
Shallow Copy :
A shallow copy creates a new object, but only copies the top-level
properties from the original object. Its work only single level .
28
Deep Copy :
A deep copy creates a new object and recursively copies all properties and
nested objects from the original object.
29
Keep Exploring
Javascript with
us!
29