Reverse-2

 

In this example, JavaScript reverse function will reverse the string. string 'I love learnkode.com' will be changed to "moc.edoknrael evol I". See the code snippet:

 
 
 
<!DOCTYPE html> <html> <head> <title>Welcome to LearnKode - A code learning platform</title> </head> <body> <script> var text = 'I love learnkode.com'; var result= text.split('').reverse().join(''); document.write(result); </script> </body> </html>
Output