Rest Operator for Objects

object,tipjs,es6

Now we can use rest on the properties of an Object. It allows us to explicitly extract certain named variables, and assign any uncalled variables into a catchall Object.

const options = {
  enabled: true,
  text: 'Hello',
  color: 'red'
}
const { enabled, ...others } = options
console.log(enabled) // true
console.log(others)  // { text: 'Hello', color: 'red' }

Có thể bạn đã miss một số snippets code

Hàm lày ngày trong tuần javascript

Hàm lày ngày trong tuần javascript

Random String

Random String với độ dài tuỳ chọn

JavaScript: async/await with forEach

JavaScript: async/await with forEach()

Getting the last element of a split string array

Getting the last element of a split string array

How to use the spread operator to flatten array of objects in javascript

How to use the spread operator to flatten array of objects in javascript