New RegExp and cycle?

"Mama I'm a programmer!".......

How to make select all coincidences?

https://jsfiddle.net/n3h36hd6/

Entered in the field "Enter words separated by commas" - a,b,c
Enter in the "Enter text" - a b c - select only c

In console.log can see that each letter is added < / span></span>

Thank you.
July 9th 19 at 10:15
1 answer
July 9th 19 at 10:17
Solution
Thank you. Works. Only have <span>+ arr[i] +</span>replace <span>$&</span> - nickolas93 commented on July 9th 19 at 10:20

Find more questions by tags JavaScript