XJavascript.com
Toggle Menu
Home
Online Javascript Compiler
Tutorials
JavaScript Tutorials
TypeScript Tutorials
Blog
All Posts
ES6+ Modern JavaScript
Review your knowledge of new features like arrow functions,destructuring,and modules.
1. Which keyword declares a block-scoped variable that cannot be reassigned?
var
let
const
function
2. What is the correct syntax for an arrow function that takes a parameter 'x' and returns x * 2?
(x) => x * 2
function(x) { return x * 2 }
x => { x * 2 }
(x) -> x * 2
3. Which of the following are features introduced in ES6 (2015)? (Select all that apply)
Arrow functions
Classes
Hoisting
Template literals
var keyword
4. Template literals in JavaScript are enclosed in single quotes (').
True
False
5. What keyword is used to export a single default value from a module?
6. What does object destructuring allow you to do?
Extract multiple properties from an object into variables
Create a new object from variables
Merge two objects into one
Convert an object to an array
7. Which of the following are valid uses of the spread operator (...) in ES6+? (Select all that apply)
Copying an array
Adding elements to the start of an array
Passing array elements as function arguments
Defining a rest parameter in a function
8. An async function always returns a Promise.
True
False
9. What does the nullish coalescing operator (??) do?
Returns the right operand if the left is null or undefined
Returns the right operand if the left is falsy
Returns the left operand if the right is null
Compares two values for strict equality
10. What constructor is used to create a new Promise object?
11. Which variable declarations are block-scoped? (Select all that apply)
var
let
const
function
12. Rest parameters (...) collect remaining function arguments into an array.
True
False
13. Which keyword is used to inherit from a parent class in ES6 classes?
extends
inherits
super
prototype
14. What is the output of: `console.log(${2 + 3})`?
15. What is the primary purpose of the optional chaining operator (?.)?
Access nested object properties safely
Check if a variable is null
Coalesce nullish values
Spread object properties
16. Which are valid ES6 module import statements? (Select all that apply)
import { func } from './module.js'
import * as mod from './module.js'
require('./module.js')
import './module.js'
17. Variables declared with 'let' are hoisted but cannot be accessed before declaration (temporal dead zone).
True
False
18. Which feature do template literals provide that regular strings do not?
Multi-line strings without concatenation
Automatic escaping of special characters
Faster performance
Storage of numeric values
19. What term describes function parameters that have predefined values if no argument is provided?
20. Which ES6+ features simplify asynchronous code handling? (Select all that apply)
Promises
async/await
Callbacks
setTimeout
Reset
Answered 0 of 0 — 0 correct