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.
Remove item in array javascript es6
Những bạn nào mà đã sử dụng ES6 một thời gian rồi thì có thể sử dụng method array.filter()
How to reverse an Array?
Reversing an array in JS is really simple with the standard array method. Like below