Detect when your site is visible to users
tipjs,web_developer
document.onvisibilitychange = function () {
document.visibilityState === "visible"
? (document.title = "👋 Hello")
: (document.title = "😟 Bye!");
};Có thể bạn đã miss một số snippets code
Spread Operator for Objects
Using the spread operator during an Object declaration will assign the properties of the referenced Object to the new Object.
flatMap()
Use flatMap() creates a new array with sub-array elements flattened by specified depth.
Merge Array
How to combine two sorted arrays into one? We can do this easily with the spread operator.
Filter Unique Values
Kiểu đối tượng Set đã được giới thiệu trong ES6 và cùng với ..., ‘spread’ operator, chúng ta có thể sử dụng nó để tạo một mảng mới chỉ với các giá trị duy nhất.