-1

I have to replace the special characters in my string with underscore. replace() function is used to do it . I know that.

My string is "545123_Claims#Claims#Claims000117".

But the issue is that replace() accepts sting as input.

Actually my string is in an array like filArr= ["545123_Claims#Claims#Claims000117"].

So how can I replace the special character in thisstring which is inside an array?

Jane Fred
  • 1,379
  • 7
  • 23
  • 47

1 Answers1

1

You could map the replaced strings by taking a function.

const replacementFn = string => string.replace(/xxx/, 'yyy');

filArr = fillArr.map(replacementFn);
Nina Scholz
  • 376,160
  • 25
  • 347
  • 392