1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
solmaris [256]
3 years ago
5

Reverse Word Order: Write a program that reverses the order of the words in a given sentence. This program requires reversing th

e order of the words wherein the first and last words are swapped, followed by swapping the second word with the second to last word, followed by swapping the third word and the third to last words, and so on.
Computers and Technology
1 answer:
ElenaW [278]3 years ago
8 0

Answer:

function reverseArray(arr) {

   if (arr.length > 1) {

      arr = [arr[arr.length-1], ...reverseArray(arr.slice(1, -1)), arr[0]]

   }

   return arr;

}

function reverseSentence(sentence) {

   let words = reverseArray( sentence.split(" ") );

   return words.join(" ");

}

console.log( reverseSentence("The quick brown fox jumps over the lazy dog's back") );

console.log( reverseSentence("one two three") );

console.log( reverseSentence("one two") );

console.log( reverseSentence("Single") );

Explanation:

This is a solution in javascript leveraging several powerful constructs in that language, such as the spread operator.

You might be interested in
All animations on the world wide web are flash animations
natima [27]

Not every animation on the web is Flash but currently the majority is. There exists simple GIF based animations as well as other technologies for animation such as Silverlight and HTML5. Most believe HTML5 will eventually replace Flash.

6 0
3 years ago
Read 2 more answers
toThePowerOf is a method that accepts two int arguments and returns the value of the first parameter raised to the power of the
inessss [21]

Answer:

cubeVolume = toThePowerOf(cubeSide, 3)

Explanation:

The function toThePowerOf, receives two int arguments say, a and b, where a is the first argument and b is the second argument as follows:

toThePowerOf(a,b)

The function returns the first argument(a) raised to the power of the second argument (b) i.e a ^ b as follows:

toThePowerOf(a, b){

return a^b

}

In the call to the function, the first argument a, is replaced with the variable cubeSide and the second argument b is replaced with the value 3.

Hence, the returned result becomes cubeSide ^ 3 which is then stored in a variable cubeVolume as follows:

cubeVolume = toThePowerOf(cubeSide, 3)

6 0
2 years ago
Sizing handles are used in Microsoft® Word® to _____.
Kamila [148]
<span>Sizing handles are used in Microsoft Word to resize an object.</span>
8 0
3 years ago
________ can be written only once. The data cannot be erased or written over once it is saved.​
notka56 [123]

Answer:

WORM (Write Once, Read Many)

Explanation:

The full meaning which means Write Once, Read Many implies that data can only be entered (or better put, written) once. Once the data has been written, the data can not be updated or deleted. However, the data being stored on WORM can be read as many times, as possible.

Hence, WORM answers the question.

6 0
2 years ago
Help!! Best answer will get Brainliest!!
Eddi Din [679]

Answer:

answer(s):

-set goals

-select a topic

-write down research questions

Hope this helped and sorry for the bold. <3

Explanation:

6 0
2 years ago
Read 2 more answers
Other questions:
  • Playville is a tiny town in fictional middle earth, which is inhabited by dwarves and elves. Playville has a playground to which
    6·1 answer
  • Generally speaking, mobile sites are good for acquiring new customers and inspiring new relationships while mobile apps are good
    6·1 answer
  • You have a Nano Server named Nano1. Which cmdlet should you use to identify whether the DNS Server role is installed on Nano1
    12·1 answer
  • Respecting culture in the workplace means understanding that
    5·2 answers
  • Which of the following is an example of a query with an explicit location? Select all that apply. True False [walmart boston], E
    7·2 answers
  • How to make logo black and white in paint?
    14·1 answer
  • It will gain you more knowledge, intensify your soft skills, strong work ethics and grow your network. What is it?​
    12·2 answers
  • How do i move a file in python3
    10·1 answer
  • How do you change colors for presentation to blue warm in power point?
    11·1 answer
  • NEED ANS ASAP THANK YOU
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!