Given string is like const testString = 'hello people, @ppshein1@gmail.com @ppshein2@gmail.com';
But I want to convert like ['@ppshein1@gmail.com', '@ppshein2@gmail.com']
and do like that:
function getString() {
const str = 'hello people, @ppshein1@gmail.com @ppshein2@gmail.com';
var n = str.slice(str.indexOf('@'), str.length);
var arr = n.split(' ');
return arr;
}
I feel it's not best practice to develop and no error handling as well. Could you guy suggest me how to improve to meet es6 syntax for above my code and be best practice. Thanks.