 | 
May 16th, 2008, 10:15 AM
|  | Moderator | | Join Date: Jun 2007 Location: York, England, with wolves. Age: 18
Posts: 2,976
| | Getting next free array index.
In php doing the below would assign the value to the next free index
[php]
// var $array has indices up to [7]
$array[] = "foo";
// $array[8] will now hold 'foo'
[/php]
Is there a way to do this in javascript?
| 
May 16th, 2008, 10:39 AM
|  | Expert | | Join Date: Jan 2008 Location: Bath, UK
Posts: 1,482
| | Quote: |
Originally Posted by markusn00b In php doing the below would assign the value to the next free index
[php]
// var $array has indices up to [7]
$array[] = "foo";
// $array[8] will now hold 'foo'
[/php]
Is there a way to do this in javascript? | array.push('foo');
In PHP too, you can use array_push($array, "foo"); | 
May 16th, 2008, 11:00 AM
|  | Moderator | | Join Date: Jun 2007 Location: York, England, with wolves. Age: 18
Posts: 2,976
| | Quote: |
Originally Posted by hsriat array.push('foo');
In PHP too, you can use array_push($array, "foo"); | Cheers for that bro!
| 
May 16th, 2008, 11:04 AM
|  | Expert | | Join Date: Jan 2008 Location: Bath, UK
Posts: 1,482
| | Quote: |
Originally Posted by markusn00b Cheers for that bro! | ;)
good luck . . .
|  | | Thread Tools | Search 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 HTML code is Off | | | | | | What is Bytes?
We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights.
Get the best answers to your questions from over 205,248 network members.
|