Array Push
Object: Array_name
Method or Function: push(arg)
Syntax: Array_name. push(arg)
Push method add elements end of the array.
We have month array which contains first six months. We want another last six month to join or append to the existing month array.
Example
<script type="text/javascript">
var month = new Array("January" , "February", "March", "April", "May", "June");
month.push("July", "August", "September", "October", "November", "December");
var string = month.join();
document.write(string);
</script>
Output
January,February,March,April,May,June,July,August,September,October,November, December
No comments:
Post a Comment