Vue.js / Nuxt.js

Modern JavaScript (ES6+)

Promises, async/await, modules, classes, map/filter/reduce, optional chaining, nullish coalescing

20 interview questions·
Junior
1

What is a Promise in JavaScript?

Answer

A Promise is an object representing the eventual completion or failure of an asynchronous operation. It allows handling operations that take time (HTTP requests, file reads) without blocking code execution. A Promise can have three states: pending (waiting), fulfilled (successfully resolved), or rejected (failed with an error).

2

What is the purpose of the async keyword before a function?

Answer

The async keyword automatically transforms a function into an asynchronous function that always returns a Promise. Even if the function returns a simple value, it will be automatically wrapped in a resolved Promise. This allows using await inside the function to wait for other Promises in a more readable way than with then() and catch().

3

What does the optional chaining operator ?. do in JavaScript?

Answer

The optional chaining operator allows safely accessing nested properties of an object that could be null or undefined. If an intermediate property is null or undefined, the expression returns undefined instead of throwing an error. This avoids writing numerous manual checks and makes code more concise and readable.

4

What is the difference between null and undefined in JavaScript?

5

How to import a named function from an ES6 module?

+17 interview questions

Master Vue.js / Nuxt.js for your next interview

Access all questions, flashcards, technical tests, code review exercises and interview simulators.

Start for free