Given string is like const testString = 'hello people, @[email protected] @[email protected]';
But I want to convert like ['@[email protected]', '@[email protected]']
and do like that:
function getString() {
const str = 'hello people, @[email protected] @[email protected]';
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.