📜  从电子邮件地址节点 js 检索域 - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:01:15.083000             🧑  作者: Mango

代码示例1
var email = "john.doe@email.com";
var name   = email.substring(0, email.lastIndexOf("@"));
var domain = email.substring(email.lastIndexOf("@") +1);

console.log( name );   // john.doe
console.log( domain ); // email.com