Write a function which accepts a sentence as input
parameter.Each word in that sentence is to be reversed.
Space should be there between each words.Return the
sentence
with reversed words to main function and produce the
required output.
for eg:- i/p: jack jill jung kill
o/p: kcaj llij gnuj llik



Write a function which accepts a sentence as input parameter.Each word in that sentence is to be r..

Answer / Prem Prakash

function reverseWords(sentence) {n let words = sentence.split(" ");n let reversed_words = [];n for (let i = 0; i < words.length; i++) {n reversed_words.unshift(words[i]);n }n return reversed_words.join(" ");n}

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More Programming Languages AllOther Interview Questions

why we need to take u?

1 Answers  


what is programming language?

2 Answers   TCS,


Data Structure:  How many comparisons are necessary to find the largest and smallest of a set of n distinct elements?  

0 Answers   Student,


Hello Experts, What is the difference between move and move corresponding exactly? please post me asap

1 Answers  


Difference between delegates and Events?

1 Answers  


What is algorithm in SCD Type2(SAS DI Studio Transformaton)?

2 Answers  


Given: (x-2)(x+3)= 100; solve the equation for x using any programing language.

2 Answers   Amazon, Manhattan,


1.What is difference between symget and & in sas? 2.what is difference between callsymput and %let?

1 Answers   CitiGroup,


what is session state?

1 Answers   HCL,


List and explain any five built in functions for Lists data type in python

1 Answers   Peerless,


Write a program that prints the numbers from 1 to 100. But for multiples of three print "Fit" instead of the number and for the multiples of five print "Bit". For numbers which are multiples of both three and five print "FitBit".

1 Answers  


how do you generate source code for the automatic generation for receipt number

2 Answers   Infosys,


Categories