I currently have this in my code:
var user = this.value.split("@")[0];
var domain = this.value.split("@")[1];
I would love to be able to do something like this:
var user, domain = this.value.split("@");
(But of course this creates an empty variable "user", and assigns "domain" to the array returned by .split())
I managed to do this in PHP like so:
list($user, $domain) = explode('@', $_POST['user']);
Was wondering if there is a JavaScript equivalent?