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

tipjs,date,function

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

const getWhatDay = () => {
  return new Date().getDay() ? new Date().getDay() : 7
}
console.log(getWhatDay());//3

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

How to reverse an Array?

Reversing an array in JS is really simple with the standard array method. Like below

Copy a string to the clipboard

Copy a string to the clipboard. Only works as a result of user action (i.e. inside a click event listener).

flatMap()

Use flatMap() creates a new array with sub-array elements flattened by specified depth.

Object.keys và Object.getOwnPropertyNames

Object.keys và Object.getOwnPropertyNames

Tránh viết biến có phạm vi global

Đôi khi bạn cần phải viết một tập lệnh trực tiếp trên trang. Cần lưu ý rằng trong code của bạn vô tình khai báo một biến toàn cầu. Vì phạm vi toàn cầu phức tạp hơn nên việc tìm kiếm chậm hơn rất nhiều