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

using javascript callback style error handling

serialize Form

Sử dụng formdata constructor để convert form, FormData, array.from(). Kết hợp window.encodeURIComponent() để encode từng value trong form.

flatMap()

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

Ajax, call jQuery POST to node.js expressjs

Ajax, call jQuery POST to node.js expressjs

Detect when your site is visible to users

Detect when your site is visible to users