ECMAScript 2015 (commonly known as ES6) marked a massive evolutionary leap for JavaScript, introducing syntax enhancements that made code cleaner, more modular, and easier to scale. Core additions included block-scoped variable declarations (let and const), concise arrow functions (() => {}), template literals with backticks, and destructuring assignments for arrays and objects. Furthermore, ES6 expanded the core language toolkit with rest/spread operators (...), default parameters, classes, and native asynchronous support through Promises. Mastering these modern syntax conventions is critical for efficient front-end development and technical software engineering interviews.
JavaScript ES6 Features MCQs
1 min read
Correct Answer: b) let is block-scoped, whereas var is function-scoped.
Explanation:
Variables declared with 'let' are scoped to the nearest enclosing block, whereas 'var' declarations are scoped to the containing function or global scope.
Correct Answer: b) It throws a ReferenceError due to the Temporal Dead Zone (TDZ).
Explanation:
Variables declared with let and const reside in the Temporal Dead Zone from the start of the block until the declaration is evaluated.
Correct Answer: b) They cannot be reassigned, but objects and arrays assigned to them can have their properties or elements mutated.
Explanation:
const prevents variable reassignment, but properties of reference types like objects and arrays can still be mutated.
Correct Answer: b) Arrow functions lexically bind 'this', inheriting it from the surrounding enclosing execution context.
Explanation:
Unlike regular functions that create their own dynamic 'this' binding, arrow functions capture 'this' from their enclosing lexical scope.
Correct Answer: c) Having their own local 'arguments' object
Explanation:
Arrow functions do not have their own 'arguments' object; any attempt to access 'arguments' references the outer enclosing scope.
Correct Answer: b) Hello, Alice!
Explanation:
Template literals enclosed by backticks allow expression interpolation using `${expression}` syntax.
Correct Answer: b) To unpack values from arrays into distinct variables in a single concise statement
Explanation:
Array destructuring allows extracting values from arrays and assigning them to distinct variables conveniently.
Correct Answer: a) Using the assignment operator `=` after the variable name in the destructuring pattern, e.g., `const { x = 10 } = obj;`
Explanation:
If the extracted property is undefined, the default value specified after the `=` operator is used.
Correct Answer: b) Expands an iterable array into individual elements
Explanation:
The spread operator unpacks elements from iterable collections into places where individual elements are expected.
Correct Answer: a) To collect all remaining arguments passed to a function into a true array
Explanation:
Rest parameters allow representing an indefinite number of arguments as an array.
Correct Answer: a) function multiply(a, b = 1) { return a * b; }
Explanation:
ES6 introduced default parameter syntax, allowing parameters to be initialized with default values if no argument or undefined is passed.
Correct Answer: d) All of the above
Explanation:
ES6 enhanced object literals include property value shorthands, concise method syntax, and computed property names.
Correct Answer: a) class Person { constructor(name) { this.name = name; } }
Explanation:
ES6 introduced the `class` keyword as syntactic sugar over JavaScript's prototype-based inheritance model.
Correct Answer: c) extends
Explanation:
The `extends` keyword is used in class declarations to create a child class that inherits from a parent constructor.
Correct Answer: a) To call the parent class constructor and bind its prototype chain
Explanation:
When used in a constructor, `super()` calls the parent class constructor, which must be executed before accessing `this`.
Correct Answer: a) Pending, Fulfilled, Rejected
Explanation:
A Promise exists in one of three states: pending (initial), fulfilled (success), or rejected (failure).
Correct Answer: b) promise.then(onFulfilled, onRejected)
Explanation:
The `then()` method returns a Promise and accepts callback functions for success and failure cases.
Correct Answer: a) Using promise.catch(onRejected)
Explanation:
The `catch()` method handles rejections anywhere in a promise chain.
Correct Answer: b) A new promise resolved with an array containing the fulfillment values of all input promises in order
Explanation:
Promise.all() waits for all input promises to fulfill, returning an array of their results.
Correct Answer: a) It resolves or rejects as soon as any one of the input promises settles (fulfills or rejects), with the value or reason from that promise.
Explanation:
Promise.race returns a promise that settles as soon as the first input promise settles.
Correct Answer: a) export function myFunc() {}
Explanation:
ES6 modules use the `export` keyword to publish functions, variables, or objects.
Correct Answer: b) import helper from './utils.js';
Explanation:
Default exports can be imported using any identifier name directly without curly braces.
Correct Answer: a) A primitive data type whose instances are unique and immutable, often used as hidden object property keys
Explanation:
Symbols are unique, immutable primitive values used primarily to serve as unique property keys avoiding name collisions.
Correct Answer: a) A key-value data structure where keys can be of any data type (including objects and functions)
Explanation:
Unlike standard objects whose keys are limited to strings and symbols, `Map` allows keys of any type.
Correct Answer: a) It stores unique values of any type, automatically discarding duplicate entries.
Explanation:
A `Set` stores unique values of any type, automatically ignoring duplicate entries.
Correct Answer: a) A collection of key/value pairs whose keys must be objects and are weakly referenced, allowing garbage collection if no other references exist
Explanation:
WeakMap keys are objects with weak references, allowing garbage collection when no other references remain.
Correct Answer: a) A collection of garbage-collectable object values without strong references
Explanation:
WeakSet stores only objects weakly, allowing them to be garbage-collected when unreferenced.
Correct Answer: a) Creates a new, shallow-copied Array instance from an array-like or iterable object
Explanation:
Array.from() converts array-like objects or iterables into true JavaScript arrays.
Correct Answer: a) Creates a new Array instance with a variable number of arguments, regardless of number or type of the arguments
Explanation:
Array.of() creates a new array instance from variable arguments, avoiding single-number sparse array issues.
Correct Answer: a) The value of the first element in the array that satisfies the provided testing function
Explanation:
find() returns the first element satisfying the callback test, or undefined if no match is found.
Correct Answer: a) -1
Explanation:
findIndex() returns the index of the first matching element, or -1 if none match.
Correct Answer: a) includes(), startsWith(), and endsWith()
Explanation:
ES6 added convenient prototype methods on String to simplify substring verification.
Correct Answer: a) Constructs and returns a new string which contains the specified number of copies of the string on which it was called
Explanation:
The repeat() method returns a new string consisting of multiple concatenated copies.
Correct Answer: a) To determine whether the passed value is an integer number
Explanation:
Number.isInteger() returns true if the argument is a number and an integer.
Correct Answer: a) Number.isNaN() does not force type coercion of the argument, returning true only if the value is a number and its value is NaN.
Explanation:
Global isNaN coerces non-number arguments first, whereas Number.isNaN does not coerce.
Correct Answer: a) Copies all enumerable own properties from one or more source objects to a target object, returning the modified target object
Explanation:
Object.assign() merges or shallow copies object properties.
Correct Answer: a) It behaves like `===` except it correctly treats `NaN` as equal to `NaN` and `+0` as not equal to `-0`.
Explanation:
Object.is provides SameValue comparison semantics for edge cases like NaN and signed zeros.
Correct Answer: a) A function that can be paused and resumed using the `yield` keyword, returning an iterator object
Explanation:
Generator functions are declared with an asterisk and yield multiple values over time.
Correct Answer: a) yield
Explanation:
The `yield` keyword pauses generator execution and emits an iterator value.
Correct Answer: a) A standard way for an object to produce a sequence of values, requiring a `next()` method that returns an object with `value` and `done` properties
Explanation:
The iterator protocol defines sequential traversal yielding `{ value, done }` objects.
Correct Answer: a) By implementing a method with the `Symbol.iterator` key that returns an iterator object
Explanation:
Implementing `[Symbol.iterator]()` allows custom objects to be traversed using `for...of` loops.
Correct Answer: a) To iterate over iterable objects (like arrays, strings, maps, and sets) directly accessing their values
Explanation:
The `for...of` loop traverses values of any iterable collection directly.
Correct Answer: a) A built-in object that provides methods for intercepting JavaScript operations corresponding to proxy traps
Explanation:
The `Reflect` API provides static methods mirroring proxy operations.
Correct Answer: a) An object used to define custom behavior for fundamental operations like property lookup, assignment, and function invocation
Explanation:
A `Proxy` wraps a target object and intercepts operations through custom handler traps.
Correct Answer: a) A feature where recursive functions that make a tail call do not grow the call stack, preventing stack overflow errors
Explanation:
TCO allows engine-level recycling of stack frames when a function's last action is a recursive call.
Correct Answer: a) Binary uses `0b` or `0B`, and octal uses `0o` or `0O` prefixes
Explanation:
ES6 introduced explicit literal prefixes: `0b`/`0B` for binary and `0o`/`0O` for octal.
Correct Answer: a) A feature that allows parsing template literals with a custom function (tag) to manipulate the interpolation output
Explanation:
Tagged templates let you parse string literals through a custom tag function.
Correct Answer: a) An array of literal string strings split around the expression placeholders
Explanation:
The first parameter receives literal string chunks split by expression interpolations.
Correct Answer: a) Using the `static` keyword before the method name, e.g., `static info() {}`
Explanation:
Static methods are called on the class itself rather than instances, using the `static` keyword.
Correct Answer: a) Yes, by prefixing the method name with an asterisk `*`, e.g., `*generatorMethod() {}`
Explanation:
ES6 supports generator methods in classes and object literals using generator syntax.
Correct Answer: a) 4
Explanation:
Math.trunc() removes fractional digits, returning the integer part without rounding.
Correct Answer: a) -1
Explanation:
Math.sign() returns the sign of a number (-1, 0, or 1).
Correct Answer: a) The difference between 1 and the smallest floating point number greater than 1, useful for floating-point comparisons
Explanation:
Number.EPSILON represents machine precision tolerance for floating-point calculations.
Correct Answer: a) The maximum integer that can be represented accurately without loss of precision ($2^{53} - 1$)
Explanation:
Integers above MAX_SAFE_INTEGER cannot be guaranteed to be unique or accurate due to IEEE 754 precision limits.
Correct Answer: a) They provide strict mode by default, support isolated module scopes to prevent global namespace pollution, and enable explicit dependency imports/exports.
Explanation:
ES6 modules bring native modular architecture with encapsulated scopes and explicit imports/exports.
Correct Answer: a) type="module"
Explanation:
Setting `type="module"` instructs the browser to parse script files as ES6 modules.
Correct Answer: a) ES6 modules are parsed, loaded, and evaluated asynchronously (deferred by default).
Explanation:
Module scripts are deferred by default, executing after HTML parsing completes.
Correct Answer: a) Yes, any number of named exports can be defined using the `export` keyword.
Explanation:
A single module file can export multiple named variables, functions, or classes.
Correct Answer: a) import { originalName as newName } from './module.js';
Explanation:
The `as` keyword is used to alias imported or exported module bindings.
Correct Answer: a) Imports all exported members of './utils.js' as properties of a single namespace object named 'utilities'
Explanation:
Namespace imports bundle all named exports into a single namespace object container.
Correct Answer: a) Throws a TypeError at runtime
Explanation:
Reassigning a constant variable throws a TypeError in JavaScript.
Correct Answer: a) "function"
Explanation:
Classes in ES6 are syntactically based on prototype inheritance and evaluate to the type "function".
Correct Answer: a) Yes, if a constructor returns an object, that object will be returned as the instance of new.
Explanation:
If a constructor explicitly returns an object, that object overrules the default `this` instance.
Correct Answer: a) To call methods or access properties defined on the parent class prototype
Explanation:
Using `super.methodName()` allows derived classes to invoke parent prototype methods.
Correct Answer: a) Promise.resolve(value)
Explanation:
Promise.resolve() returns a Promise object resolved with the given value.
Correct Answer: a) Promise.reject(reason)
Explanation:
Promise.reject() returns a Promise object rejected with the specified reason.
Correct Answer: a) Schedules a callback to be called when the promise is settled (either fulfilled or rejected), useful for cleanup tasks.
Explanation:
The finally() method runs regardless of whether the promise succeeded or failed.
Correct Answer: a) const obj = { ['key_' + 1]: 'value' };
Explanation:
Computed property names allow wrapping expressions in square brackets inside object literals.
Correct Answer: a) const { user: { address: { city } } } = data;
Explanation:
Object destructuring supports deep nesting by nesting property patterns inside assignments.
Correct Answer: a) Throws a TypeError
Explanation:
Attempting to destructure properties from `null` or `undefined` throws a TypeError.
Correct Answer: a) No, the rest parameter must be the last parameter in the function definition.
Explanation:
The rest parameter must always be the final parameter in a function definition.
Correct Answer: a) true
Explanation:
Array.prototype.includes() returns true if the array contains the specified element.
Correct Answer: a) includes() correctly finds NaN, whereas indexOf() cannot find NaN because NaN !== NaN.
Explanation:
includes() uses SameValueZero equality comparison, allowing it to locate NaN elements.
Correct Answer: a) false
Explanation:
9007199254740992 ($2^{53}$) is one greater than MAX_SAFE_INTEGER, exceeding safe integer precision.
Correct Answer: a) Returns a non-negative integer that is the Unicode code point value at the given position, supporting surrogate pairs correctly.
Explanation:
codePointAt() properly handles full Unicode characters outside the Basic Multilingual Plane.
Correct Answer: a) Returns a string created by using the specified sequence of code points
Explanation:
String.fromCodePoint() creates strings from Unicode code point numbers.
Correct Answer: a) No, arrow functions throw a TypeError if invoked with `new` because they lack a prototype property.
Explanation:
Arrow functions lack a prototype and cannot be invoked as constructors with `new`.
Correct Answer: a) The global `window` object
Explanation:
In the global execution context, lexical `this` of an arrow function points to the global window object.
Correct Answer: a) The number of key/value pairs in the Map
Explanation:
The `size` property returns the count of key-value entries stored in a Map or Set.
Correct Answer: a) map.clear()
Explanation:
The `clear()` method removes all key-value entries from a Map or Set.
Correct Answer: a) A boolean indicating whether an element with the specified value exists in the Set
Explanation:
The `has()` method checks for the existence of a value in a Set, returning true or false.
Correct Answer: a) No, `for...in` iterates over enumerable object property keys, whereas Sets are iterated using `for...of` or `.forEach()`.
Explanation:
Sets are iterable collections best traversed with `for...of` or `.forEach()`, not `for...in`.
Correct Answer: a) Works like the `in` operator, returning a boolean indicating whether the property exists on the object or its prototype chain
Explanation:
Reflect.has() mirrors property presence checking using the `in` operator.
Correct Answer: a) Returns an array of all own property keys (including strings and symbols) of the target object
Explanation:
Reflect.ownKeys() combines own string keys and symbol keys into a single array.
Correct Answer: a) The JavaScript engine throws a TypeError.
Explanation:
Proxies enforce structural invariants; violating underlying configurations throws a TypeError.
Correct Answer: a) Calling the `revoke()` function returned alongside the proxy instance
Explanation:
Proxy.revocable() returns `{ proxy, revoke }`. Invoking `revoke()` disables the proxy.
Correct Answer: a) The prototype of the specified object (equivalent to Object.getPrototypeOf)
Explanation:
Reflect.getPrototypeOf provides reflective access to an object's internal prototype linkage.
Correct Answer: a) No, it only copies enumerable own properties of the source objects.
Explanation:
Object.assign ignores inherited properties and non-enumerable properties.
Correct Answer: a) ['a', 'b', 'c']
Explanation:
Strings are iterables in ES6, so spreading a string expands each character into array elements.
Correct Answer: a) Passing `undefined` triggers the default parameter value, whereas passing `null` or other falsy values does not.
Explanation:
Default parameter evaluation specifically checks if the argument is strictly `undefined`.
Correct Answer: a) It communicates immutability of binding intent to other developers and helps engines optimize variable bindings.
Explanation:
Using `const` signals that the variable reference will not be reassigned, improving clarity.
Correct Answer: a) They cannot be used as constructors and throw a TypeError.
Explanation:
Arrow functions lack a prototype property and throw a TypeError if called with `new`.
Related Posts
New
New
New

Python Strings MCQs
In Python, a string (str) is an immutable sequence of Unicode characters used to represent text data. Defined using single,…
August 27, 2026By MCQs Generator

Python OOP MCQs
Object-Oriented Programming (OOP) in Python is a programming paradigm that uses classes and objects to model real world entities, promoting…
August 27, 2026By MCQs Generator

JavaScript Hoisting MCQs
Hoisting is a fundamental mechanism in JavaScript where variable and function declarations are notionally moved to the top of their…
August 29, 2026By MCQs Generator
Related Categories
New












AI & Data Science MCQ
5 topics
By MCQs Generator
New
Arts & Humanities MCQ
4 topics
By MCQs Generator
New
Civil Engineering MCQ
4 topics
By MCQs Generator
New
Commerce & Business MCQ
4 topics
By MCQs Generator
New
Competitive Exams MCQ
5 topics
By MCQs Generator
New
Electrical & Electronics Engineering MCQ
3 topics
By MCQs Generator
New
General Knowledge MCQ
2 topics
By MCQs Generator
New
General Science MCQ
4 topics
By MCQs Generator
New
Law & Judiciary MCQ
3 topics
By MCQs Generator
New
Mechanical Engineering MCQ
4 topics
By MCQs Generator
New
Medical & Health Sciences MCQ
4 topics
By MCQs Generator
New
Modern Tech Fields MCQ
3 topics
By MCQs Generator