How to separate host and domain in email?

how to separate host and domain in email?

i found a json response like this [“[email protected]”] .

how to separate host and domain to put into variables in postman?

I’ve got to ask, did you try and search Google for this first as this is a common JavaScript query.

Square brackets usually indicate an array, so you may have to reference your element with [0]

const email = "[email protected]";

const array = email.split('@');

let host = array[0];
let domain = array[1];

console.log(host);
console.log(domain);