Problem Solving | Reverse a string

Developer, trying to understand, learn and teach better.
Search for a command to run...

Developer, trying to understand, learn and teach better.
No comments yet. Be the first to comment.
After speaking to many developers and aspirants, I realized that the first question that bothers most folks is, "how do I get started?" As someone who is mostly self-taught, I wish someone had given me this guidance when I started out. I'm breaking ...
What is a Singly Linked List? A singly linked list is a linear data structure similar to an array. However, unlike arrays, elements are not stored in a particular memory location or index. Rather each element is a separate object that contains a poin...

Data Structures are a collection of values, the relationship between them and the functions or operations that can be applied to the data. What are the different data structures available? The most commonly used data structures are Singly Linked Li...

Question: Write a program that prints the numbers from 1 to n. But for multiples of three, print "Fizz" instead of the number, and for the multiples of five, print "Buzz". For numbers which are multiples of both three and five, print "FizzBuzz" Opti...

Given a string, return a new string with the reversed order of characters.
Examples:
reverse('apple') === 'leppa'
reverse('hello') === 'olleh'
reverse('Greetings!') === '!sgniteerG'
Pseudo Solution:
function reverse(str) {
let arrayString = [... str]
arrayString.reverse();
return arrayString.join('');
}
Simplified solution:
function reverse(str) {
return [...str].reverse().join('');
}
Without using the .reverse function
function reverse(str) {
let reversed = "";
for (let character of str) {
reversed = character + reversed;
}
return reversed;
}