Question: JAVASCRIPT PLZ Given a string of words separated by spaces, write a function that swaps the first and last letters of every word. You may

JAVASCRIPT PLZ

Given a string of words separated by spaces, write a function that swaps the first and last letters of every word. You may assume that every word contains at least one letter, and that the string will always contain at least one word. You may also assume that each string contains nothing but words and spaces, and that there are no leading, trailing, or repeated spaces.

example:

swap('Oh what a wonderful day it is'); // "hO thaw a londerfuw yad ti si" swap('Abcde'); // "ebcdA" swap('a'); // "a"

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!