Seeking a solution for transforming the contents of a JavaScript variable.
var data = "ashley, andy, juana"
The desired output is as follows:
var data = "Sports_ashley, Sports_andy, Sports_juana"
We need this transformation to be dynamic and able to handle any number of commas within the variable.
If anyone knows an easy way to accomplish this task, please share.