Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
100% found this document useful (1 vote)
549 views

ECMAScript 6

ES6 is the latest version of ECMAScript that introduced many new features like arrow functions, classes, modules, promises etc. It supports features like template literals for multiline strings, rest/spread properties, destructuring, block scoping etc. Classes introduce inheritance through the extends keyword and static methods. Sets, Maps and Symbols are new data types introduced in ES6. Promises are used for asynchronous programming and have 3 states - pending, fulfilled and rejected. Variables declared with let, const and class have block scope unlike var.

Uploaded by

Shantha Moorthy
Copyright
© © All Rights Reserved
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
100% found this document useful (1 vote)
549 views

ECMAScript 6

ES6 is the latest version of ECMAScript that introduced many new features like arrow functions, classes, modules, promises etc. It supports features like template literals for multiline strings, rest/spread properties, destructuring, block scoping etc. Classes introduce inheritance through the extends keyword and static methods. Sets, Maps and Symbols are new data types introduced in ES6. Promises are used for asynchronous programming and have 3 states - pending, fulfilled and rejected. Variables declared with let, const and class have block scope unlike var.

Uploaded by

Shantha Moorthy
Copyright
© © All Rights Reserved
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 2

ECMAScript6

----------------
ES6 is the implementation of? - ECMAScript
All major JavaScript Implementations are based on which standard? - ECMAScript
ES6 is officially called _ - ECMA Script 2015
ECMAScript is a _ - Language Standard
ES6 can be used for __ - both
How many parts are there in an ES6 module? - 2
----------------
"Rest" collects all variables into a single array, while "Spread" expands a single
variable into multiple. - true
Which of the following parameters can be used to expand a single array into
multiple arguments? - Spread
const { x, y } = { x: 11, y: 8 }; is the Same as const { x: x, y: y } = { x: 11, y:
8 }; - true
During destructuring, you can either declare variables or assign to them, or both.
- false
Which of the following parameters can be used to define indefinite number of
parameters in one single array? - Rest
What will be the output of following code snippet? - 6,5
function foo(a = 10, b = 5) {
console.log(a, b);
}
foo(6);
The following code implements the ______ feature of ES6 - spread
Destructuring helps us to extract multiple values from an object via - Object
Pattern
---------------------
Template literals can be defined as _ - multi-line string literals that support
interpolation
What will be the output of the following code snippet? - 23
const func= (
x,
y
) => {
return x + y;
};
func(11,12);

Arrow Functions are less verbose than traditional functions - True


Template literals support - interpolation
Template literals can be reused _ true
Instead of using single quotes or double quotes, es6 uses BACKTICK or OPENQUOTE ( "
` " ) character to create destructuring pattern. - false
Variables declared in a scope are accessible in _ - All scopes nested inside it
In Arrow functions, if there is only one parameter and that parameter is an
identifier then the parentheses can be omitted. - true
Which is not a lexical inside arrow functions? - none

Template literals does not allow us to _ - not corect build complex html and xml
templates.
Select the wrong code Snippet - not correct const func5 = (x, y) => x + y;
---------------------
Which keywords can be used to implement inheritance in ES6? - extends
_ feature helps us to simplify the inheritance concept. - classes
The bodies of class declarations and class expressions are executed in strict mode.
- true
Which is not true about constructor in ES6? - A class may have any number of
constrcutors
Which is not true about static methods? - Static methods can be directly called
with the help of a class object.
Sets can be used to store _ - Heterogeneous data
We can use this data-type to avoid repetitions. - sets

Map can use _______ value as Key. - any


Maps can be used to store _ - Key - value pairs
----------------------
Symbols can be created using the factory function - Symbol()
What will be the output of this code? var sym = new Symbol(); - Syntax Error
What will be printed if the following code is executed? - 1

let x=150;
if(x>100)
{
x=1;
}
console.log(x);
Objects declared as "const" are immutable. - false
What is the meaning of the following line of code? const pi=3.14; - Const turns
variables into constants, and they can’t be changed.
Declaring variables with which of the following keywords, will make the variable
immutable? - var
A Promise has _________ number of states. - 3
What is the scope of the variable "a" in function below? - block

function val(x){
if(x>0){
let a = x;
console.log(a);
}
}
Variables declared with which of the following constructs do not have block scope?
- const
Keyword "let" allows redeclaring variables. - FALSE
Which of the following statements is not true about level of scope? - I & III are
true and II and IV are false.
I. let keyword declares a block scoped variable.
II. var keyword declares a block scoped variable.
III. const keyword declares a block scoped variable.
IV. let and const are similiar to each other.
What is the significance of the following code snippet? The variable i is valid
only inside the for loop
for (let i = 0; i < 10; i++) {
x += 10;
}
Which of the following does not declare a block scoped variable? - var
Promise reactions are callbacks that you register with the Promise method then(),
to be notified of a fulfillment or a rejection. - true
What if promise2 get rejected in the following syntax? Promise.all(promise1,
promise2, .....) - It will reject the entire set
Which method can be used to retrieve symbols from the global symbols registry? -
Symbol.keyfor()
Which of the following is not a state of Promise? - Approved
--------------------
It is always a good practice to physically separate the code based on _ - mostly
Functionality **** not all
ES6 modules are stored in _ - files

You might also like