Basic Algorithm Scripting - Reverse a String

Tell us what’s happening: I need help in solving this challenge
Describe your issue in detail here.

Your code so far

function reverseString(str) {
  let reverseStr = "hello";
  for(let i = str.length - 1; i >= 0; i--){
   // console.log([i]);
    reverseString += str[i];

  return reverseString;

let Result = reverseString("hello");

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/ Safari/537.36

Challenge: Basic Algorithm Scripting - Reverse a String

Link to the challenge:

Hi @Dovyjane !

Welcome to the forum!

You have a few issues going on here

First issue:
You created this variable called reverseStr and assigned it the string hello. But you are not doing anything with it.
You need to find a way to use that variable in your code later on and return the end result. Also you shouldn’t assign it "hello".

Second issue:

reverseString is the name of the function. Maybe you meant to use the variable called reverseStr here?

Third issue:

You are returning the function instead of the reversed string result.

Fourth issue:

I would remove this completely because it is not doing anything and doesn’t need to be there.

Hope that helps!

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.