|
|
push array values using javascript array push() - Javascript
|
Views : 725
|
|
Tagged in : Javascript
|
|
|
Report This Scrap as Inappropriate We request you to choose the appropriate categroy and subcategory that suits your
objectionable concern about the scrap, So that our team can review and find out whether it violates our Guidelines or the
scrap is not suitable for all viewers.
|
Push Array Values outside the loop using Javascript Array Push():
Javascript array push() allows user to push array values to outside of the loop inorder to access all the array values.
for eg,
<script>
var arr = new Array();
function test(n){
//returns some values here
}
for(i = 0; i <= 5; i++)
{
arr.push(test(i));
}
document.getElementById('res').value = arr;
</script>
<input type=text id='res' size=25>
In the above example array values will be stored in array variable "arr" and all the values are assigned to textbox using the array variable "arr". |
|
By Ramya, On - 2009-08-21 |
|
|
|