Basic Algorithm Scripting - Reverse a String

Hi,
I just wanted to make sure I haven’t missed something, just finished data structures and moved into Algorithm Scripting. Does this section assume existing knowledge or skills not obtained through the rest of the JavaScript challenges?

I feel like I haven’t been equipped to do these challenges through the exercises leading up to this point. There is no explanation that I can remember learning regarding the coding needed to complete this, judging from the provided solutions.

Your code so far

function reverseString(str) {
  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/108.0.0.0 Safari/537.36

Challenge: Basic Algorithm Scripting - Reverse a String

Link to the challenge:

The provided solutions are just some possible approaches. This can be done with a for loop and string concatenation, both of which you did in previous challenges.

I recommend against looking up the answers when you are stuck. This block of challenges is not about guessing the right syntax - its more about writing down a logical plan to accomplish the task. Most of these challenges can be done with if statements and for loops alone.

Also, reading and writing code are both important skills, but they are separate skills. You can’t really practice writing code after having read answers, but you certainly can practice reading code after writing an answer.

It’s totally normal to get stuck! This is the hard part - breaking down a problem into logical steps that a computer understands. I would encourage you to ask questions here instead of looking up and trying to duplicate other people’s answers. You’ll learn more that way.

Please do not look at the solutions until you have created your own solution first.
If you’re stuck ask for help (but don’t look at solutions).
Also note that solutions have direct relationship with the curriculum (the people who wrote them were using whatever knowledge they had and weren’t thinking about what people have learned so far).

The word Algorithm here requires that you work out a way to do things that a computer can do. So try to use what you know to come up with a plan to solve each problem then write that plan into code.

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