Convert Array-like to True Array

object,array,tipjs

This is cool! Learning something new @wesbos ES6 course 🔥

const nodeList = document.querySelectorAll('ul li');

// Method 1: Convert to true Array
Array.from(nodeList);

// Method 2: Convert to true Array
[...nodeList];

// Now you can use map and other methods to loop

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

Detect when your site is visible to users

Detect when your site is visible to users

Callback in javascript

Callback in javascript

Async await in javascript

Async await in javascript

try/catch es10

An update for developer convience allows the use of try/catch without an explicit e Error reference in the catch call.

Sử dụng reduce và concat làm phẳng một array

Array.reduce() và Array.concat() có thể giúp chúng ta làm phẳng một Array như: