How to replace character in string with space in javascript ?

var string="Non-consumable"

Open in new window


I want to replace "-" from above string with " " (space);
How to do it ?
Pradip ShenolkarAsked:
Who is Participating?
 
Rgonzo1971Commented:
Hi,

pls try

var string ="Non-consumable";
var res = string.replace("-", " ");

Regards
0
 
Pradip ShenolkarAuthor Commented:
thanks,  it works.
and one more thanks for quick reply.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.