for github badge #532
Answered
by
abdurahmon27
Xondamirxon
asked this question in
Q&A
-
Write a function in JavaScript that takes a string as input and returns the string with its characters reversed. However, you are not allowed to use any built-in methods like split(), reverse(), or join(). |
Beta Was this translation helpful? Give feedback.
Answered by
abdurahmon27
Jan 1, 2025
Replies: 1 comment
-
` // Example usage: |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
Xondamirxon
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
`
function reverseString(input) {
let reversed = '';
for (let i = input.length - 1; i >= 0; i--) {
reversed += input[i];
}
return reversed;
}
// Example usage:
console.log(reverseString("hello")); // Output: "olleh"
`