1. What is JavaScript? Difference between java & JavaScript, features, Is JavaScript a case-sensitive language? What are the advantages of JavaScript? JS libraries & frameworks.
JavaScript is a popular scripting language for web development. You can use it for both the client and server sides. It enables the insertion of code into HTML pages, allowing web browsers to comprehend and execute it. Furthermore, JavaScript supports object-oriented programming features.
Difference between Java and JavaScript
Java | JavaScript |
It is object oriented programming language | It is object oriented scripting language |
It is used to build large-scale enterprise applications such as android apps, server-side systems etc. | It is primarily used for developing web applications that run on browsers such as client and server side scripting. |
A Java Virtual Machine (JVM) is used to run Java programmes. | As a feature of the browser’s JavaScript engine, JavaScript is executed within web browsers. |
Yes, JavaScript is a case-sensitive language.
Advantages
- It is possible to have dynamic and interactive web experiences, which improves user interaction and engagement with websites.
- All the currently used web browsers support JavaScript which makes it widely available and cross-platform compatible.
- Also it provides a vast ecosystem of libraries and frameworks that helps in web development and enables quick prototyping and effective coding.
Frameworks
React.js, Angular.js, Vue.js, Ember.js, Backbone.js, Meteor.js, Express.js, Next.js, Electron.js, Svelte.js
Libraries
jQuery, Lodash, Moment.js, Axios, Chart.js, Underscore.js, D3.js, Popper.js, Hammer.js, Paper.js
2. What are the scopes of a variable in JavaScript?
There are multiple scopes in JavaScript that control the accessibility and lifespan of variables. The scopes are as follows:
- Global Scope: The scope of variables defined outside of any functions has global scope.
- Function Scope: The function accesses the variables with the functional scope.
- Block Scope: You can view and access variables only inside the block of code. It is commonly denoted using curly ‘{}’ brackets.
3. What are the variable naming conventions in JavaScript?
You are required to follow the following naming conventions while naming JavaScript variables:
- Always remember to use meaningful and descriptive names. The variable name must convey the purpose or content.
- Try to use camelCase for multi word variable names.
- The variable names should not include spaces.
- JavaScript is a case-sensitive language, so it considers variables with different capitalization, like “First” and “first,” as different.
- Variable names should not begin with a numeral (0-9) but must start with a letter or an underscore.
- Avoid using reserved keywords as variable names, such as “continue”, “and”, “this”, etc.
- Any variable name can accept a letter, underscore (_), or dollar ($) as first character.
- Avoid the use of special characters such as !, @, #, %, etc. You cannot use them within the variable names. It can lead to syntax errors.
4. What is the difference between Attributes and Property?
Attributes in JavaScript offer additional information about an element, such as its id, type, or value, as mentioned in the HTML markup. Properties, on the other hand, indicate the actual values allocated to those attributes, such as type=”text” or value=”Name”. Attributes provide context for elements, whereas properties store the values applied to those attributes.
5. Name the different types of JavaScript data?
Following are the data types in JavaScript:
- Null: they store unknown or empty values.
- Undefined: it stores variables that you have declared but have not yet defined or initialized.
- Boolean: you can use it to store true/false values.
- Number: you can use it to store integers and floating-point numbers.
- BigInt: it allows you to safely store and operate on huge integers that are larger than the safe integer limit for Numbers.
- String: you can use it as a series of 16-bit unsigned integer values representing UTF-16 code units that make up the String type, which represents textual data.
- Symbol: you can use it to store unique identifiers for objects.
Also Read JavaScript Coding Interview Questions and Answers
6. What is the difference between Null and Undefined?
Null | Undefined |
Null indicates that the value is absent for the defined variable. | When a variable or a property is uninitialized or not found undefined occurs. |
It is a value that can be assigned to a variable. | It is a state in which a variable can be in. |
It is a type of object. | It is a type of undefined. |
7. How to create an array in JavaScript?
Following are the ways to create array in JavaScript:
- Array literal syntax:
let arr1 = [] // empty array
let arr2 = [1, 2, 3, 4, 5] // array initial values
- Array constructor:
let arr1 = new Array() // empty array
let arr2 = new Array(1, 2, 3, 4, 5) // array initial values
8. Mention the different types of functions supported in JavaScript?
Different types of functions are as follows:
- Function Declarations
function nameOfFunction(params) {
// function code
}
- Function Expressions
let nameOfFunction = function(params) {
// function code
};
- Arrow Functions
let nameOfFunction = (params) => {
// function code
}
- Immediately Invoked Function Expressions
(function() {
// function code
})();
- Method Functions
let object = {
nameOfMethod: function(parameters) {
// function code
}
};
- Generator Functions
function* nameOfGeneratorFunction() {
// function code
}
- Async Functions
async function nameOfAsyncFunction() {
// function code
}
- Constructor Functions
function NameOfConstructor(parameters) {
this.data = value;
// constructor logic
}
9. What is “this” keyword in JavaScript?
In JavaScript, we refer to “this” as the currently calling object. In JavaScript, the this keyword is widely used in constructors to assign values to the properties of an object. The current object being constructed can be referenced dynamically, allowing for the instantiation of specified values for its properties.
10. How to create objects in JavaScript?
You can create an object in JavaScript in the following way:
var obj = {
company: “Explore UI”,
blogName: “JavaScript Interview Questions”
writer: “Ganesh”
}
11. What is closure?
Whenever a variable that is defined outside the current scope is needed to be accessed inside the current scope we use closures. It gives you access to an outer function’s scope from an inner function. In JavaScript, closures are created every time a function is created. To use a closure, simply define a function inside another function and expose it.
Example:
function outerFunction(name){
var surname = "Eich";
return function innerFunction(){
console.log(name+' '+surname);
}
}
var x = outerFunction("Brendan");
x();
Output
Brendan Eich
12. Difference between “==” and “===” operators?
In JavaScript, you use the ‘==’ operator for loose equality comparison, which allows type coercion. It converts the operands to a common type before comparison. On the other hand, you use the ‘===’ operator for strict equality comparison. It checks for equality without performing type coercion, ensuring that both the value and type of the operands match for equality.
13. What are the possible ways to define a variable in JavaScript?
Following are the ways to define a variable in JavaScript:
- var: The ‘var’ keyword allows redeclaration and reassignment of variables. Reassignment means you can change the value of the variable. Redeclare means declaring the variable with the same name. It has function-level scope. For example: var x = 10; here the variable x has value 10.
- let: The ‘let’ keyword allows reassignment and it has block-level scoping. For example: let x = 15; here the variable x has a value of 15.
- const: You cannot change the value assigned of the const variable once you assign the value to it. It also has block-level scoping. For example: const x = 20; here the variable x has a value of 20.
14. What are the terms BOM and DOM in JavaScript?
- BOM: BOM is also called the Browser Object Model. The window object consists of a location, history, navigator, screen, document, and other attributes. It offers tools and techniques for interacting with the browser window, including tools for managing cookies, controlling history, and changing URLs.
- DOM: DOM is also called a Document Object Model. It is a document object that helps in representing the HTML document and it is used in accessing and changing the content of the HTML through a scripting language.
15. Explain the terms array slice() and array splice()?
slice(): The slice method in JavaScript returns the new array containing the portion of the original array. It takes two optional parameters: the starting index (inclusive) and the ending index (exclusive). The original array remains untouched.
Example:
let numbers = ['one', 'two', 'three', 'four', 'five'];
let slicedNumbers = numbers.slice(1, 3);
console.log(slicedNumbers); // Output: [ 'two', 'three' ]
console.log(numbers); // Output: [ 'one', 'two', 'three', 'four', 'five' ]
splice(): It is a method that changes the content of an array by removing, replacing, or adding elements at a specific position. It takes three parameters: the starting index, the number of elements to remove, and optional new elements to add. This function returns the array of the removed elements.
Example:
let numbers = ['one', 'two', 'three', 'four', 'five', 'six'];
let splicedNumbers = numbers.splice(3, 3, 'seven', 'eight', 'nine');
console.log(splicedNumbers); // Output: [ 'four', 'five', 'six' ]
console.log(numbers); // Output: [ 'one', 'two', 'three', 'seven', 'eight', 'nine' ]
16. Explain what the isNaN() function is?
The isNaN() function in JavaScript returns true if the provided number is not a number. Following is the example of the isNaN() function in JavaScript.
console.log( isNaN('100F') ); // output: true
console.log( isNaN(100) ); // output: false
17. How to make an array empty?
Following are the ways to make an array empty in JavaScript:
- Reassigning the Array:
let Arr = [1, 2, 3, 4, 5]
Arr = [] // empty array
- Modifying the Array Length:
let Arr = [1, 2, 3, 4, 5]
Arr.length = 0; // empty array
18. Define the mechanism of the ‘typeof’ operator?
In JavaScript, you use the typeof operator to identify the data type of a value or variable. It gives back a string that contains the information of the operand’s type. The mechanism of the typeof operator involves examining the internal representation and characteristics of the value to determine its type. Following is the example of the typeof operator.
typeof 35; // Output: "number"
typeof "ExploreUI"; // Output: "string"
typeof false; // Output: "boolean"
typeof undefined; // Output: "undefined"
typeof null; // Output: "object"
typeof [1, 2, 3]; // Output: "object"
typeof function() {}; // Output: "function"
19. How to add and remove properties from objects?
To add and remove properties from the JavaScript objects you can use dot or square bracket notation. Following in the example to add and remove properties from the JavaScript objects.
// adding properties
let myObject = {};
myObject.companyName = "ExploreUI";
myObject["writerName"] = "Ganesh";
console.log(myObject);
/* Output
{ companyName: 'ExploreUI', writerName: 'Ganesh' }
*/
// removing properties
delete myObject.companyName;
delete myObject["writerName"];
console.log(myObject);
/* Output
{}
*/
20. How to represent the date object in JavaScript?
Following is the way to represent the date object in JavaScript:
let currentDate = new Date(); // Current date and time
var year = 2023, monthIndex = 7, day = 3, hours = 1, minutes = 46, seconds = 45, milliseconds = 345
let specificDate = new Date(year, monthIndex, day, hours, minutes, seconds, milliseconds); // Specific date and time
console.log(currentDate) // Output: 2023-07-02T19:16:38.773Z
console.log(specificDate) // Output: 2023-08-03T01:46:45.345Z
21. What is meant by the debugger in JavaScript?
In JavaScript, a debugger statement is a powerful tool used for debugging code. When encountered, it triggers a breakpoint in the code execution and allows you to analyze the program’s state, step through the code, and inspect variables.
22. How to write a comment in JavaScript?
There are two ways to write a comment in JavaScript. Following are the ways to write a comment:
Single Line Comment: The single line comment starts with double forward-slash (“//”).
// Hello this is single line comment
Multi Line Comment: The multi line comment starts with forward slash and asterisk (“/*”) and ends with asterisk and forward slash (“*/”).
/* Hello,
This is multi line comment
Bye. */
23. What is the output of 10+20+”30″ & “10”+20+30 in JavaScript?
In the first case the output will be “3030”. In the second case the output will be “102030”.
In the first case the first operation will be 10 + 20 that results 30. Later it performs concatenation with “30”. Therefore 30+”30” = 3030.
In the second case the first operation will be “10” + 20. The number 20 will be concatenated with string (“10”) this results “1020”. Then again “1020” is concatenated with 30 that results “102030”.
24. What are Exports & Imports?
- Exports
- The term “exports” is used to make a module’s functionality available for use by other modules.
- You can make certain functions, objects, or values from a module accessible to other modules by using “exports”.
- Imports
- You can use the “imports” term to add features from other modules to the current module.
- To use certain functions, objects, or values in the current module, you can selectively import them using imports from other modules.
25. What is the role of a strict mode in JavaScript?
The strict mode in JavaScript has the function of establishing a more stringent set of rules for code execution. It enables safer coding practices, improves code quality, and decreases possible flaws. It also disables several error-prone features, restricts the use of undeclared variables, and helps catch common coding errors. Following is an example of using strict mode.
"use strict";
a=15;
The above code will give a ReferenceError.
26. Explain Hoisting in JavaScript.
Hoisting is a type of behavior JavaScript where all the declaration of functions and variables are moved to the top. In other words, it is a method where the variables and functions are shifted to the top of the scope, regardless of where they were originally declared. Both local and global scopes are possible in hoisting. Following are examples of hoisting.
hoistedVariable = 27;
console.log(hoistedVariable)
var hoistedVariable // this variable declaration will be moved to the top
callFunction();
function callFunction(){ // this function will be moved to the top
console.log("Hello World!");
}
27. Explain Higher Order Functions in JavaScript.
The higher order functions in JavaScript are the functions that take function as argument and it also returns function as a result. Following is an example of higher order function in JavaScript.
function higherOrderFunction(operation, x, y) {
return operation(x, y);
}
function multiply(x, y) {
return x * y;
}
let answer = higherOrderFunction(multiply, 7, 15); // Pass the multiply function as an argument
console.log(answer); // Output: 105
28. Explain call(), apply(), and bind() methods.
- call(): The call() method in JavaScript is used to invoke a function. It is also used to describe the value of ‘this’ within the invoked function. Following is an example of the call() method.
function display(){
console.log(`Welcome to ${this.company}`)
}
var x = {company: 'ExploreUI'};
display.call(x);
- apply(): The apply() method is similar to the call method; the only difference is that the apply() method takes arguments as an array or an array-like object. Following is an example of the apply() method.
function display(text){
console.log(`${text} to ${this.company}`)
}
var x = {company: 'ExploreUI'};
display.apply(x, ['Welcome']);
- bind(): The bind() method returns a new function with a bound execution context, which allows you to bind a specific value to “this” within the function forever. The function is not invoked immediately but it does create a new function with the bound “this” value and any specified arguments. Following is an example of the bind() method.
function display(text){
console.log(`${text} to ${this.company}`)
}
var x = {company: 'ExploreUI'};
var y = display.bind(x, ['Welcome']);
y();
29. What is Currying in JavaScript?
Currying is a JavaScript technique that converts a function with several parameters into a series of functions, each with a single argument. You can use the curried function partially, allowing you to generate specialized functions from a generic one. Following is an example of currying in JavaScript.
function multiply(a){
return function(b){
return function(c){
return a*b*c;
};
}
}
// first way
console.log(multiply(10)(20)(30)); // output: 6000
// second way
let multiplya = multiply(10);
let multiplyb = multiplya(20);
let multiplyc = multiplyb(30);
console.log(multiplyc); // output: 6000
30. What are arrow functions?
Arrow functions are a short syntax for defining functions in JavaScript. Arrow functions have simplified syntax also they lexically bind ‘this’. They do not have ‘this’, ‘arguments’, or ‘super’ keywords of their own. We often use it as inline function expressions. Following is the syntax of the arrow function.
const multiply = (a, b) =>{
return a*b;
}
console.log(multiply(10, 20)); // output: 200
31. What is the rest parameter and spread operator?
Rest Parameter
The rest parameter in JavaScript is a parameter that allows you to pass an indefinite number of arguments to the function as an array. We use three dots (…) to denote the rest operator. We need to add three dots and a parameter name to use the rest parameter. Following is an example that shows the use of rest parameter.
function arraySum(...numbers){
let sum = 0;
for(let i=0; i<numbers.length; i++){
sum+=numbers[i];
}
return sum;
}
console.log(arraySum(1, 2, 3, 4, 5, 6, 7, 8, 9, 10)); // output: 55
Spread Operator
You can use the spread operator to divide an iterable (such as an array) into individual elements. The representation of three dots (…) also allows you to use object destructuring in a variety of scenarios. When used with an array, it “spreads” the array’s elements into separate values.
let arr = [1, 2, 3, 4, 5];
console.log(...arr); // output: 1 2 3 4 5
let newArr = [...arr, 6, 7, 8];
console.log(...newArr); // output: 1 2 3 4 5 6 7 8
32. What is the use of promises in JavaScript?
We handle asynchronous operations in JavaScript with the help of promises. They also provide a way to manage the outcome of asynchronous functions. They make asynchronous programs easier to write by letting you link many operations together and handle success and failure with the then() and catch() methods. Promises allow for more readable and maintainable code when dealing with asynchronous operations in JavaScript.
33. What are classes in JavaScript?
Classes are a blueprint for creating objects. JavaScript classes give a simpler and more organized manner of defining and creating objects with shared behavior. Current JavaScript apps frequently use them for implementing OOP concepts and structuring code.
34. What are generator functions?
Generator functions are a special type of function in JavaScript. We use the function* syntax to define the generator functions. The generator function returns a generator object. This iterator object helps us to define an iterative algorithm. You can use the iterator object to control the execution of the generator function and retrieve values generated by it. The following is the example of the generator function.
function* tableOfFive(){
for(let i=1; i<=10; i++){
yield (5*i);
}
}
const generator = tableOfFive();
console.log(generator.next().value); // output: 5
console.log(generator.next().value); // output: 10
console.log(generator.next().value); // output: 15
console.log(generator.next().value); // output: 20
console.log(generator.next().value); // output: 25
35. What is Object Destructuring?
We call the method of extracting elements from an object or an array “object destructuring”. Following are examples of object destructuring in JavaScript.
// array destructuring
let arr = [1, 2, 3]
let [first, second, third] = arr;
console.log(first, second, third); // Output: 1 2 3
// object destructuring
let obj = {
name: "Ganesh",
age: 23,
country: "India"
}
let {name, age, country} = obj;
console.log(name, age, country); // Output: Ganesh 23 India
36. What is a Temporal Dead Zone?
The temporal dead zone (TDZ) is a behavior in JavaScript that helps in the prevention of usage of variables (only for let and const data types) before they are declared. It helps you to catch and prevent the potential errors that can be caused because of accessing variables too early. Following is the example where the temporal dead zone is observed.
console.log(x);
let x = 10;
37. What is Callback?
A callback is a function in JavaScript that you pass as an argument to another function. The other function executes the callback after its own execution finishes, hence it is called a ‘callback’.
38. List out the different ways an HTML element can be accessed in JavaScript code.
Following are some ways by which an HTML element can be accessed in JavaScript code.
- getElementById: you can use it to access elements based on their ‘id’.
- getElementsByClassName: you can use it to access elements based on their ‘class names’.
- getElementsByTagName: you can use it to access elements based on their ‘tag names’.
- querySelector: you can use it to access the first element that matches a specified CSS selector.
- querySelectorAll: you can use it to access all the elements that match a specified CSS selector.
- getAttribute: you can use it to get the value of a particular attribute after you have a reference to an element.
39. What is the difference between Cookies, Local storage & Session storage?
Local Storage | Session Storage | Cookies |
Capacity of local storage is 10MB. | Capacity of Session storage is 5MB. | Capacity of Cookies is 4KB. |
Stores data in the browser with no expiration date. | Stores data in the browser, accessible only for a session. | Stores data in small text files. |
Not encrypted. | Not encrypted. | Encrypted. |
Stored in the browser. | Stored in the browser. | Stored in browser and server. |
It does not have the option of auto expiry. | It has the option of auto expiry. | It has the option of auto expiry. |
40. What is the difference between window & document in JavaScript?
Window | Document |
It represents the browser window or global content. | It represents the currently loaded web page. |
It can be accessed as ‘window’. | It can accessed as ‘window.document’ or ‘document’. |
Global scope for JavaScript code in the browser. | It is the part of the window object that provides access to the webpage. |
Parent object to the ‘document’ and other objects. | It is the child object of the ‘window’ object. |
41. How do JavaScript primitive/object types passed in functions?
Primitive types (passed by value)
Passing primitive types by value means a copy of the value is created and the copy is passed to the function. Even if the value is modified in the function during execution it does not affect the original value that is outside the function. Following is an example where we pass value to the function.
function multiplyBy2(num){
num = num*2;
console.log(num);
}
let num = 5;
multiplyBy2(num); // output: 10
console.log(num); // output: 5
Object types (passed by reference)
Object types are passed to functions via reference, which means that a reference to the object is provided to the function. If the value inside the function changes then the original value will also get affected. Following is an example where we pass reference to the function.
function update(arr){
arr.push(4);
console.log(arr);
}
let arr = [1, 2, 3];
update(arr); // output: [ 1, 2, 3, 4 ]
console.log(arr); // output: [ 1, 2, 3, 4 ]
42. What are escape characters in JavaScript?
Escape characters are unique symbols that you use to represent characters that are hard or impossible to write directly into a string or part of code. They are read as a separate character or sequence when prefixed with a backslash (\). Following are some examples of the escape characters in JavaScript.
let message1 = 'I\'m reading a blog on JavaScript.';
let message2 = "\"Hello World!\"";
console.log(message1); // I'm reading a blog on JavaScript.
console.log(message2); // "Hello World!"
43. What are undeclared and undefined variables?
- Variables that have not been declared or defined using the var, let, or const keywords are known as undeclared variables. While attempting to access an undefined variable, it raises a ReferenceError.
- Variables that have been declared but not given a value are known as undefined variables. They have an undefined value. While accessing an undefined variable does not produce an error, it returns the value undefined.
44. What are the different types of errors in JavaScript?
- SyntaxError: It occurs when there is a syntax mistake in code.
- ReferenceError: It occurs when a variable or a function is referenced but has not been declared in scope.
- TypeError: It occurs when you perform an operation on an inappropriate type of value.
- RangeError: It occurs when the numeric value is outside the allowed range.
- EvalError: It occurs when an error occurs during the evaluation of JavaScript code.
- URIError: It occurs when you use functions like encodeURI(), encodeURIComponent(), decodeURI(), and decodeURIComponent() incorrectly.
- InternalError: It occurs due to some internal failure.
45. What is a window.onload and onDocumentReady?
- window.onload: This event is triggered as soon as the entire web page has finished loading. We use it to ensure that all the resources are available before performing actions that depend on them.
- onDocumentReady: It is an event that takes place once the DOM has been built and is prepared for manipulation, though it might not happen until all external resources, like pictures, have loaded completely. Libraries like jQuery use it oftenly. It allows you to execute code as soon as DOM is ready. It does not wait for external resources to finish loading.
46. event propagation – bubbling – capturing
In JavaScript, the term “event propagation” refers to the process through which events are handled and passed up the DOM hierarchy. The catching phase and the bubbling phase are the two stages of event propagation.
- Capturing Phase: During this phase the event will start at the highest-level ancestor element. This will continue and will travel down the target element in the DOM hierarchy. The event handlers that are attached during the capturing phase are triggered even before the event reaches the target element. We do not use this phase commonly in practice.
- Bubbling Phase: In this phase we propagate towards the highest-level ancestor in the DOM hierarchy, starting from the target element. As the event passes through each ancestor element, handlers applied during the bubbling phase are activated. It is the default behavior for most of the DOM events.
47. What is namespacing in JavaScript, and how is it used?
The method of grouping the desired functions, variables, etc., under a single name is called namespacing. It is a name that you give to the desired properties, objects, and functions. As a result, the coding becomes more modular and allows us to reuse the code. We can use namespacing in the following way.
var myNamespace = {
var1: 'Hello',
func1: function() {
console.log('Welcome to ExploreUI!');
}
};
console.log(myNamespace.var1); // Output: Hello
myNamespace.func1(); // Output: Welcome to ExploreUI!
48. What are the important JavaScript Array Methods explain with example?
- length property: This property helps you to find the length of the array (number of elements in the array).
- reverse method: This method allows you to reverse the order of items in the array.
- sort method: This method allows you to sort the elements inside the array in increasing order.
- pop method: This method allows you to remove the last element from the array.
- shift method: This method helps you to remove the first element of the array.
- push method: This method allows you to add new elements to the array. The newly pushed element will be the last element in the array.
- unshift method: This method allows you to add new elements to the array. The newly pushed element will be the first element in the array.
let arr = [4, 3, 2, 1, 6, 5]
// length property
console.log(arr.length); // Output: 6
// reverse property
console.log(arr.reverse()); // Output: [ 5, 6, 1, 2, 3, 4 ]
// sort method
console.log(arr.sort()); // Output: [ 1, 2, 3, 4, 5, 6 ]
// pop method
arr.pop();
console.log(arr); // Output: [ 1, 2, 3, 4, 5 ]
// shift method
arr.shift();
console.log(arr); // Output: [ 2, 3, 4, 5 ]
// push method
arr.push(7);
console.log(arr); // Output: [ 2, 3, 4, 5, 7 ]
// unshift method
arr.unshift(1);
console.log(arr); // Output: [1, 2, 3, 4, 5, 7 ]
49. What is the prototype?
The prototype is an inherent characteristic of every object in JavaScript. In other words, a prototype is an object that serves as a blueprint or template for other objects. In JavaScript, every object has a prototype from which it can inherit methods and properties. The prototype-based inheritance paradigm enables code reuse and the building of large object hierarchies.
50. What features are there in es6?
Following are some important features in ES6:
- Arrow Functions: Simpler way of writing functions.
- Template Literals: Enhanced string literals that handle multi lines and interpolation.
- let and const: Block-scoped variables which provides better scoping of variables.
- Destructuring Assignment: Efficient method for extracting values from objects and arrays.
- Modules: Native assistance with import/export capabilities and flexible code architecture.
- Classes: Introduced with more recognizable syntax for class definition and inheritance implementation.
- Default Parameters: It enabled default values for function parameters.
- Spread and Rest Operators: Provided an easy way to manipulate arrays and objects.
- Promises: Introduced with a new mechanism for handling asynchronous functions.
- Enhanced Object Literals: Provided a simplified syntax for adding methods and declaring objects.