Tell us what’s happening:
i get the error Cannot assign to read only property ‘0’ of string ‘hello’
Your code so far
function reverseString(str) {
for(let i=0;i<str.length/2;i++){
let temp=str[i];
str[i]=str[str.length-1-i];
str[str.length-1-i]=temp;
}
return str;
}
reverseString("hello");
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.119 Safari/537.36
.
Link to the challenge: