Lấy ngày hiện tại trong javascript
date,tipjs,function
Lấy ngày hiện tại trong javascript
const getDay = (fillFlag=true) => {
const day = new Date().getDate()
const dayRe = day
if (fillFlag) day < 10 ? `0${day}` : day
return dayRe
}
//Ouput:
console.log(getDay());//27Có thể bạn đã miss một số snippets code
Merge Array
How to combine two sorted arrays into one? We can do this easily with the spread operator.
Đếm có bao nhiêu items giống nhau trong một array
reduce javascript. Đếm có bao nhiêu items giống nhau trong một array
using Typescript callback style error handling
Spread Operator for Objects
Using the spread operator during an Object declaration will assign the properties of the referenced Object to the new Object.
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ư: