JavaScript code is here in increase the size.
- <html>
- <body bgcolor="lightgreen">
- <h3>Automatically increases size of array </h3>
- <hr color="green">
- <p>Currently size of array is 3 ([1],[1],[2])</p>
- <head><script type="text/javascript">
- var someArray = new Array();
- alert(someArray.length);
- someArray[0] = "A";
- alert(someArray.length);
- someArray[1] = "B";
- alert(someArray.length);
- someArray[2] = "C";
- alert(someArray.length+" ----> This is the increased index i.e [3]...Now array size becomes 4");
- </script>
- </head>
- </body>
- </html>
Thank you, keep learning and sharing.