JavaScript: ReplaceAll with Array

jsfiddle example with Jasmine unit test