article

reverse the words in a string

[WHAT]

  1. ] test was "reverse the words in a string"
    1. ] my thinking to create a solution was to use the split function on the 'space' char to create an arrary of words out of the string,
    2. ] then print out the array from the last item to the first item

[WHY]

[WHERE]

  1. ]

[WHEN]

  1. ]

[EXAMPLE]

  1. ]
let reverseWords = function(stringToReverse){
 
  // array likely has a method to reverse the elements, but will use my own iteration
  var wordArray = stringToReverse.split(' ');
  var reversedString ="";
   for ( i= wordArray.length, i >= 0, i--){
      reversedString += wordArray[i]+' ';
  }
  return reversedString;
}

[HOW-TO]

  1. ]

[REFERENCE]

  1. [] src =

 

 

 

Details Photos Edit more

Details

ID: 2626

NAME: code-quiz-question

DESCRIPTION: code-quiz-question - "reverse the words in a string" -

AUTHOR: article.author/s

EDITOR: article.editor/s

PUBLISHER: article.publisher/s

STATUS: Write

PRIORITY: -5

OWNER ID: 75

Content Photos Edit more

photos

page_photo

actions

Email Email-Owner SMS and