Rolling loading

tipjs,object,es6

Nguyên tắc là theo dõi các sự kiện cuộn trang và phân tích mối quan hệ thuộc tính giữa clientHeight , scrollTopscrollHeight .

window.addEventListener('scroll', function() {
  const clientHeight = document.documentElement.clientHeight;
  const scrollTop = document.documentElement.scrollTop;
  const scrollHeight = document.documentElement.scrollHeight;
  if (clientHeight + scrollTop >= scrollHeight) {
    // Xử lý ở đây
    // ...
  }
}, false);

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

Callback in javascript

Callback in javascript

Rest Operator for Objects

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.

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

using Typescript callback style error handling

Merge Array

How to combine two sorted arrays into one? We can do this easily with the spread operator.