Commonly Asked ES6 Interview Questions and Answers
1) What is ES6?
ES6 is a scripting language specification standardized.
It is used to enable client-side scripting.
The specification is influenced by programming languages (Self, Python, Perl, Java etc).
2) What are the Features of ES6?
There are
11 Features of ES6 are as follow:
- Modules
- Classes
- Iterators
- Generators
- Block Scope
- Collections
- Arrow Functions
- Template Literals
- Extended Literals
- De-structuring Assignment
- Enhanced Object Properties
3) Who is the inventor of ES6?
Designed by
Brendan Eich.
4) How to export a single value or element in a Module?
By using
export default element_name
5) How to export multiple values or elements in a Module?
By using
export {element_name1,element_name2,....}
6) What are the predefined types of Error Objects available in ES6?
Error Objects available in ES6 are:
URIError
EvalError
TypeError
RangeError
SyntaxError
ReferenceError
7) What is location.replace()?
It is the replace() method of window.location object which is used to replace the current document with a new one.
8) What is Alert Dialog Box?
It is used to send a warning message to the users and provides only one button "OK" to select and proceed.
9) What is window.print() function?
window.print() is the JavaScript print function which is used to prints the current webpage when executed and You can call this function directly by using the onclick event.
10) What are the Number Methods used in ES6?
Number Methods used in ES6 are:
Number.isNaN()
Number.parseInt()
Number.isFinite()
Number.isInteger()
Number.parseFloat()
Number.isSafeInteger()
11) What is the syntax used for creating a number object?
Syntax:
var val = new Number(number);
12) What are the Navigator-specific methods used in ES6?
Navigator-specific methods are:
javaEnabled()
taintEnabled()
plugings.refresh
preference(name,value)
13) What is the use of pop() method?
pop() method: This method is used to remove the last element from an array and returns that element.
14) What are the types of comment in ES6?
There are two types of comment in ES6:
Example:
// Single Line Comment.
Example:
/* Multiple Line Comment.*/
15) What is Callback?
Callback: In Callback, A function may be passed as a parameter to another function.