Assing array value inside function : Array : Language Basics : JavaScript DHTML examples (example source code) Organized by topic

JavaScript DHTML
C++
PHP


JavaScript DHTML  »  Language Basics   » [  Array  ]   
 



Assing array value inside function

Please note that some example is only working under IE or Firefox.

/*
Javascript Essentials
by Jason J. Manger

Publisher: Mcgraw-Hill Osborne Media; 

ISBN: 0078822343
*/

<!--
  Program 6-1
-->
<html>
<head>
<script language="JavaScript">
<!--
  var x = new Array();
  function add(arrayName, value) {
    var nextElement = arrayName.length;
    arrayName[nextElement= value;
  }
  x[0"1";
  x[1"2";
  x[2"3";
  add(x, "new value!");
  alert("The new value is: " + x[3]);
//-->
</script>
</head>
</html>

           
       
Related examples in the same category
1.  Demo all methods in Array
2.  Simple Array Demo
3.  Array loop, find:Control array : Two dimension array
4.  Reversing, Sorting, and Concatenating an Array
5.  Custom Numeric Comparison for the Array.Sort Method
6.  Case-Insensitive Comparison for the Array.Sort Method
7.   Iterating Through a Sparse Array
8.  Using Functions to Iterate Through an Array
9.  Reading and Writing Array Elements
10.  Array with a numeric parameter and assign data to it
11.  A string array
12.  Array - properties and methods:length, join, reverse, push,pop,shift
13.  Array - sort()
14.  Array - concat and slice
15.  Array - splice
16.  Methods and Properties of the Array Object
17.  Displaying the Contents of an Array
18.  Using the Array.join() Method
19.  Using JavaScript Arrays
20.  Extending the Length of an Array
21.  An Array within an Array
22.  Using the Methods of the Array object
23.  Array.sort() Possibilities
24.  Array.reverse() Method
25.   Array Concatenation
26.  A Looping Array Lookup
27.  A Simple Parallel Array Lookup
28.  Adding a prototype Property
29.  Two-Dimensional Array Work Around
30.  Array definition and iteration
31.  Reference an Array by index
32.  URL Array
33.  Array Utility functions
34.  Dynamic array
























Home| Contact Us
Copyright 2003 - 04 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.