Can anyone plz explain why my code getting error; thanks
function print(msg) {
console.log(msg);
return msg;
}
function reverseString(str) {
var result = "";
for(let i=str.length; i>=0; i--) {
result += str[i];
}
return result;
}
print(reverseString("hello"));
//output undefinedolleh