Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

Reverse a string in JavaScript

function reverseString(str) {
	let reversed = [];
	for (i = str.length - 1; i >= 0; i--) {
		reversed.push(str[i]);
	}
	return reversed.join('');
}
Source by dev.to #
 
PREVIOUS NEXT
Tagged: #Reverse #string #JavaScript
ADD COMMENT
Topic
Name
1+4 =