Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

Reverse a string in JavaScript

const reverseStr = (str)=>{
    if(!str || 2 > str.length) {
        return str
    }
    return str.split('').reverse().join('')
}

console.log(reverseStr('football'));
Source by exploretech.dev #
 
PREVIOUS NEXT
Tagged: #Reverse #string #JavaScript
ADD COMMENT
Topic
Name
7+3 =