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
Đế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
try/catch es10
An update for developer convience allows the use of try/catch without an explicit e Error reference in the catch call.
Getting the last element of a split string array
Getting the last element of a split string array
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
Convert Array-like to True Array
Convert Array-like to True Array