ES6 면접 질문과 답변
Ques 1. What is the let keyword used for in ES6?
The let keyword is used to declare block-scoped variables.
Example:
let x = 10; if (true) { let x = 20; console.log(x); } console.log(x);
도움이 되었나요?
Add Comment
View Comments
Ques 2. Explain the differences between let, const, and var.
let and const are block-scoped, while var is function-scoped. const is used for constants and cannot be reassigned.
Example:
const PI = 3.14; let x = 10; var y = 5;
도움이 되었나요?
Add Comment
View Comments
Ques 3. What are template literals in ES6?
Template literals are a way to create strings with embedded expressions. They are enclosed by backticks (`).
Example:
let name = 'John'; let greeting = `Hello, ${name}!`;
도움이 되었나요?
Add Comment
View Comments
Ques 4. Explain the arrow functions in ES6.
Arrow functions are a concise way to write functions. They do not have their own 'this' and 'arguments'.
Example:
const add = (a, b) => a + b;
도움이 되었나요?
Add Comment
View Comments
Ques 5. What is destructuring assignment in ES6?
Destructuring assignment allows you to extract values from arrays or objects and assign them to variables.
Example:
const person = { name: 'John', age: 30 }; const { name, age } = person;
도움이 되었나요?
Add Comment
View Comments
Most helpful rated by users: