|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
Hi. I'm working on a problem to take a list from a prompt, each item seperated by by a comma and a space, and use a method to convert the listed items into an array, removing the comma and space delimiters. I'm using the split() method to put the list items into an array, but I can't find any documentation on how to remove the comma and space. Could someone point me in the right direction? I'm not looking for someone to give me the code to do it, just something like, "Use ____ and a loop" or something. Thanks.
|
|
#2
|
|||
|
|||
|
Hey mominid!
The Split method removes the comma and space (or the delimiter you suply to it) Example: var numbers = '1,2,3,4,5'; var arrayNumbers = split(numbers, ','); now arrayNumbers[0] = 1 arrayNumbers[1] = 2 arrayNumbers[2] = 3 ...... ...... ...... Good Luck! ANibal. PS: arrayNumbers.length will give you the amount of elements in the array! |
![]() |
| Viewing: Dev Articles Community Forums > Programming > JavaScript Development > Beginner help |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|