code:
var text = "OK! brb then. Or afk, i maybe take longer time than i think. so please dnd :)";
var array1 = new Array("afk", "brb", "dnd");
var array2 = new Array("<Away From Keyboard>", "<Be Right Back>", "<Do Not Disturb>");
function str_replace(search, replace, subject){
var f = search, r = replace, s = subject;
var ra = is_array(r), sa = is_array(s), f = [].concat(f), r = [].concat(r), i = (s = [].concat(s)).length;
while(j = 0, i--){
while(s[i] = s[i].split(f[j]).join(ra ? r[j] || "" : r[0]), ++j in f);
}
return sa ? s : s[0];
}
function is_array(m_var){
return (m_var instanceof Array);
}
str_replace(array1, array2, text);
read the JScript 5.6 documentation on arrays
or you can go to W3Schools :)