Try something like this:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<title></title>
<script type="text/javascript">
/**
* Just add a custom
* member function to array
* object.
* @author Georgi Naumov
*/
Array.prototype.addItem=function(aKey,aValue){
if(typeof this[aKey] != 'undefined')
this[aKey] += "," + aValue;
}
var mytest=new Array(1,2,3,4,5);
mytest.addItem(1,"A");
mytest.addItem(1,"B");
alert(mytest[1]);
</script>
</head>
<body>
</body>
</html>
padew написа:
if I have books= new Array();
with this values:
1
2
3
4
5
I would like to do this:
if (something x)
add at 2 the word A
after
add at 2 the word B
so to have:
1
2, A, B
3
4
5
other condition:
I not know how much elements I add; this depend by condition if;
-----------