+ 2
How to change "letter" in a string
i want to change the second letter. i have tried this as an example: var a = "hay"; a[1] = "e"; document.write(a); but it doesnt work.
5 Antworten
+ 2
Also a good idea to drop the code you have into a Code Playground Web project and provide a link to your Code Playground code so we can help you troubleshoot the specific issues you are running into.
The Code Playground should be relatively easy to find in the website version of SoloLearn, but if you are in the app version, it can be accessed via the curly braces, green circle with plus sign to add a new project, then select the project type.
Looking forward.
+ 2
This might be more suitable for what you're trying to accomplish:
https://www.w3schools.com/jsref/jsref_replace.asp
+ 1
Probably a lot of other issues as well, but here's something useful to review:
https://www.w3schools.com/jsref/met_doc_write.asp
+ 1
"hay" is a string that I think you're trying to treat as an array ...
+ 1
var a = "hay";
a = a.replace('a','E');
console.log(a);