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'))//true

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

Spread Operator for Objects

Using the spread operator during an Object declaration will assign the properties of the referenced Object to the new Object.

Random String

Random String với độ dài tuỳ chọn

JavaScript: async/await with forEach

JavaScript: async/await with forEach()

try/catch es10

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

Await in a for loop

How to Await in a for loop