var ar = '10,13,9,8,13,10,5,3,1,9,5,8,10,2,6'; var removed = ar.replace(new RegExp('[^(' + 10 + ')]', 'g'), '')
var removed = ar.match(new RegExp('\\b'+10+'\\b','g')).join('');
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)