Kiểm tra định dạng email bằng Javascript
tipjs,validate
Kiểm tra định dạng email bằng Javascript
let isEmailAddress = val => {
return /^[\w-]+(\.[\w-]+)*@[\w-]+(\.[\w-]+)+$/.test(val) || /w+([-+.]w+)*@w+([-.]w+)*.w+([-.]w+)*/.test(val);
}
console.log(isEmailAddress('gmail.com@.com'))//false
console.log(isEmailAddress('gmail.com@gm.com'))//trueCó thể bạn đã miss một số snippets code
flatMap()
Use flatMap() creates a new array with sub-array elements flattened by specified depth.
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.
Await in a for loop
How to Await in a for loop
encode/decode base64 with JS
Encoding to base64 is done with the btoa command
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ư: