Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

reverse a string

const reverseString = (str) => {
 
const revArray = [];
const length = str.length - 1;
  
// Looping from the end
for(let i = length; i >= 0; i--) {
    revArray.push(str[i]);
}
  
// Joining the array elements
return revArray.join('');



}

//if you find this answer is useful ,
//upvote ⇑⇑ , so can the others benefit also . @mohammad alshraideh ( ͡~ ͜ʖ ͡°)
 
PREVIOUS NEXT
Tagged: #reverse #string
ADD COMMENT
Topic
Name
9+6 =