All Articles

Reverse a string in various programming language

Reversing is a common task in programming. Different language handle this task differently. I will try to figure it out in one place.

PHP:

$a = "Hello World!!!";echo strrev($a);

Python:

a= "Hello World!!!"print(a[::-1])

JavaScript:

var word = "Hello World!!!";console.log(word.split("").reverse().join(""));