Skip to content
QuiznExam

ES6+ Features in JavaScript

Test your knowledge of modern JavaScript features introduced in ES6 and later, including let and const, arrow functions, template literals, destructuring, spread and rest operators, classes, modules, promises, and collections.

15
Questions
12 min
Time limit
Medium
Difficulty

No sign-up needed · Last updated:

Save your score

At least 8 characters.

Forgot password?

Related quizzes

All 15 questions and answers Spoilers: this shows the questions and answers. Try the quiz first! Open
  1. 1. Which keywords were introduced in ES6 for declaring block-scoped variables?

    • A. var and let
    • B. let and const
    • C. const and static
    • D. define and let
    Show answer

    B. let and const

    ES6 introduced let and const, both of which are block-scoped declarations.

  2. 2. Which statement about const in JavaScript is correct?

    • A. A const variable can always be reassigned
    • B. A const variable must be declared without a value
    • C. A const binding cannot be reassigned after initialization
    • D. const has function scope
    Show answer

    C. A const binding cannot be reassigned after initialization

    A const declaration creates a binding that cannot be reassigned after initialization.

  3. 3. Which syntax correctly defines an arrow function that returns the sum of a and b?

    • A. function => (a, b) a + b
    • B. (a, b) => a + b
    • C. arrow (a, b) => a + b
    • D. a, b -> a + b
    Show answer

    B. (a, b) => a + b

    Arrow functions use the => syntax and can use an expression body for an implicit return.

  4. 4. What is a notable characteristic of the this value inside an arrow function?

    • A. It always refers to the global object
    • B. It is lexically inherited from the surrounding scope
    • C. It is always undefined
    • D. It is automatically bound to the function name
    Show answer

    B. It is lexically inherited from the surrounding scope

    Arrow functions do not have their own this binding; they use the this value from their surrounding lexical context.

  5. 5. Which syntax is used for template literals in JavaScript?

    • A. Single quotes
    • B. Double quotes
    • C. Backticks
    • D. Parentheses
    Show answer

    C. Backticks

    Template literals are enclosed in backticks and support embedded expressions using ${...}.

  6. 6. Which syntax is used to embed an expression inside a JavaScript template literal?

    • A. #{expression}
    • B. ${expression}
    • C. {{expression}}
    • D. <expression>
    Show answer

    B. ${expression}

    Expressions can be embedded inside template literals using the ${expression} syntax.

  7. 7. What does array destructuring allow you to do?

    • A. Extract values from an array into variables
    • B. Convert an array into a string only
    • C. Sort an array automatically
    • D. Delete all array elements
    Show answer

    A. Extract values from an array into variables

    Array destructuring provides a concise way to unpack values from arrays into separate variables.

  8. 8. Which syntax correctly uses object destructuring?

    • A. const { name, age } = person;
    • B. const [name, age] = person;
    • C. const (name, age) = person;
    • D. const <name, age> = person;
    Show answer

    A. const { name, age } = person;

    Object destructuring uses curly braces to extract properties from an object.

  9. 9. Which operator is commonly used to spread the elements of an array into another array?

    • A. &&
    • B. ...
    • C. ??
    • D. ::
    Show answer

    B. ...

    The spread syntax (...) expands iterable elements, such as array elements, into another context.

  10. 10. What is the primary purpose of the rest parameter syntax in a function?

    • A. To collect remaining arguments into an array
    • B. To stop a function
    • C. To convert arguments into an object automatically
    • D. To repeat a function
    Show answer

    A. To collect remaining arguments into an array

    A rest parameter, written with ..., collects remaining arguments into an array.

  11. 11. Which keyword is used to define a class in modern JavaScript?

    • A. object
    • B. class
    • C. struct
    • D. type
    Show answer

    B. class

    ES6 introduced class syntax for defining classes using the class keyword.

  12. 12. Which keywords are used for exporting and importing modules in JavaScript?

    • A. send and receive
    • B. export and import
    • C. module and include
    • D. require and package
    Show answer

    B. export and import

    ES modules use export to make bindings available and import to consume exported bindings.

  13. 13. Which ES6 collection stores unique values?

    • A. Map
    • B. Set
    • C. Array
    • D. WeakMap
    Show answer

    B. Set

    A Set stores unique values, meaning duplicate values are not stored as separate entries.

  14. 14. What does a JavaScript Map primarily store?

    • A. Only strings
    • B. Only numbers
    • C. Key-value pairs
    • D. Only arrays
    Show answer

    C. Key-value pairs

    A Map is a collection of key-value pairs and allows keys of various JavaScript types.

  15. 15. Which feature was introduced in ES6 for handling asynchronous operations with a standardized object-based API?

    • A. Promises
    • B. Generators only
    • C. Namespaces
    • D. Preprocessors
    Show answer

    A. Promises

    Promises provide an object-based mechanism for representing the eventual completion or failure of an asynchronous operation.