Vue.js / Nuxt.js

Modern JavaScript (ES6+)

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

20 คำถามสัมภาษณ์·
Junior
1

What is a Promise in JavaScript?

คำตอบ

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?

คำตอบ

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?

คำตอบ

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 คำถามสัมภาษณ์

เชี่ยวชาญ Vue.js / Nuxt.js สำหรับการสัมภาษณ์ครั้งถัดไป

เข้าถึงคำถามทั้งหมด flashcards แบบทดสอบเทคนิค แบบฝึกหัด code review และตัวจำลองสัมภาษณ์

เริ่มใช้ฟรี