LearnFrenzy
Sign in Take a free test

ES6 Features · Exercise 1 of 4

ES6 Features ES6 Features MCQ

  • 15 questions
  • Page 2 of 2
  • Answers explained
0Attempted
0Correct
0Wrong
Directions

Fifteen multiple-choice questions on ES6 and modern JavaScript: classes, super, private and static members, Map, Set and WeakMap, Symbol, the iteration protocol, generators and modules. Pick an option to check your answer instantly.

Question 11 Hard

For function* g() { yield 1; return 2; }, what is [...g()]?

A [1, 2]
B [2]
C []
D [1] – spread ignores the value given by return
Question page & discussion
Question 12 Medium

A module has export default function main() {} and export const VERSION = 2;. Which import is correct?

A import { main, VERSION } from "./app.js";
B import start, { VERSION } from "./app.js";
C import main, VERSION from "./app.js";
D import * from "./app.js";
Question page & discussion
Question 13 Medium

Which statement about ES modules is true?

A Their top-level var declarations become global
B They can be loaded with a plain <script> tag without type="module"
C They run before the HTML is parsed
D They always run in strict mode and have their own top-level scope
Question page & discussion
Question 14 Medium

An object has a property with a Symbol key. Where does that key appear?

A In Object.keys like any key
B Nowhere – symbol properties cannot be read
C In Object.getOwnPropertySymbols(obj), but not in Object.keys, for…in or JSON.stringify
D Only in JSON.stringify
Question page & discussion
Question 15 Hard

Which two rules apply to class declarations but not to function declarations?

A They are hoisted with their body and can be called without new
B They must be exported and must have a constructor
C They cannot have static methods and cannot be extended
D They cannot be used before the declaration (TDZ), and they cannot be called without new
Question page & discussion
Up next · Exercise 2Predict the Output20 questions

Ready to test your Programming?

Timed online tests with instant scores and explanations.

Search LearnFrenzy

Esc

Quick links