Go Back   CodingForums.com > :: Client side development > JavaScript programming > DOM and JSON scripting

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 02-23-2012, 03:39 PM   PM User | #1
niralupatel
New to the CF scene

 
Join Date: Feb 2012
Posts: 9
Thanks: 2
Thanked 0 Times in 0 Posts
niralupatel is an unknown quantity at this point
Javascript that can flip reverse a sentence

Not going to lie it is HW for my class. I am suppose write a javascript that would ask user to enter words in a sentece, once done it reverses them.
I know you can do this by using length property or charAt() method. Or would be easier to use a loop?

I need help getting this done by today :/

Attached Thumbnails
Click image for larger version

Name:	1462acb8-4a23-4e97-9cce-905ff20f8053.jpeg
Views:	24
Size:	18.0 KB
ID:	10863  
niralupatel is offline   Reply With Quote
Old 02-23-2012, 06:21 PM   PM User | #2
felgall
Master Coder

 
felgall's Avatar
 
Join Date: Sep 2005
Location: Sydney, Australia
Posts: 5,465
Thanks: 0
Thanked 499 Times in 491 Posts
felgall is a jewel in the roughfelgall is a jewel in the roughfelgall is a jewel in the rough
Use split on the string to create an array of words, then use reverse on the array and then join to put them back together.
__________________
Stephen
Learn Modern JavaScript - http://javascriptexample.net/
Helping others to solve their computer problem at http://www.felgall.com/
felgall is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 11:06 AM.


Advertisement
Log in to turn off these ads.