How to validate email in JavaScript

Regex
Last updated Dec 16, 2017
const pattern = /\S+@\S+\.\S+/;

pattern.test("john@gmail.com");
true