I need to create a javascript function that replaces all letters of a word to an asterisk *
.It should replace the word hello123
to ********
. How can this be done ?
相关问题
- Is there a limit to how many levels you can nest i
- How to toggle on Order in ReactJS
- void before promise syntax
- Keeping track of variable instances
- Can php detect if javascript is on or not?
Try this link How to replace all characters in a string using JavaScript for this specific case: replace . by _
which will replace anything but whitespace or
which will replace every single character to
*
even whitespaceUse
str.replace(...)
.Many examples on the interwebs :-D
For example:
Or in your case:
You can just do: