javascript2018년 3월 23일2 min read

Q&A: A Collection of JavaScript Questions

A personal collection of JavaScript questions and the answers I figured out along the way.

FFrank Advenoh
#Q&A#faq#javascript

This is a personal collection where I jot down things I don't know and briefly summarize what I learn about them. If you know the answer to any of the unanswered questions, please leave a comment. Thank you.

Full Q&A List

[Answered]

1. What is This is a ${msg}?

This is a new string notation added in ES6, called a Template Literal. Template literals allow line breaks within a string without using the \ character, and they let you easily substitute the value of a variable directly through the simple ${…} string interpolation expression.

References

2. What is the difference between var, const, and let?

The const and let keywords were introduced in ES6.

  • var * the scope works at the function level

  • const

    • the scope is block-level
    • used when the value does not change
  • let

    • the scope is block-level
    • used when the value changes

References

3. What does () => ({}) mean in lambda expression form?

ES6 added lambda expression syntax. The expression () => ({}) is equivalent to function() { return { } }.

References

4. What is …?

This is syntax added in ES6 that can be used as a Spread or a Rest Parameter.

  • Spread operator

    • expands an iterable array, object, or string into individual elements
    • ex.
  • Rest Parameter

    • collects all elements into an array
    • the Rest Parameter must be the last argument

References


[Unanswered Questions]

- When is defaultProps used?

관련 글