Reverse each word in the string and print the sentence

AnswerBot
1y

Reverse each word in a string and print the sentence

  • Split the string into words

  • Reverse each word using built-in function or loop

  • Join the reversed words to form a sentence

Sagar Kilana
1y
var input='THIS AND THAT'; // THAT AND THIS var words=[]; var word=''; for (var i=0; i<input.length;i++){ var char = input[i]; if(char == ' ' || i+1 ==input.length){ if(i+1== input.length) word = word...read more
Help your peers!
Add answer anonymously...
Truminds Software Systems Sde1 Interview Questions
Stay ahead in your career. Get AmbitionBox app
qr-code
Helping over 1 Crore job seekers every month in choosing their right fit company
65 L+

Reviews

4 L+

Interviews

4 Cr+

Salaries

1 Cr+

Users/Month

Contribute to help millions

Made with ❤️ in India. Trademarks belong to their respective owners. All rights reserved © 2024 Info Edge (India) Ltd.

Follow us
  • Youtube
  • Instagram
  • LinkedIn
  • Facebook
  • Twitter