JavaScript Properties and Methods

Properties and Methods

by Kondal Durgam

JavaScript

var students = new Array("Kondal","Ram","srinu","Kumari")

Array.prototype.displayItems = function() {
	for (i = 0; i < this.length; i++) {
       document.write(this[i] + "<br />");
  }
}
document.write("student array <br />");
students.displayItems();
document.write("<br /> Number of items in stored in student array is "+ students.length + " <br />");
document.write("<br /> items is SORTED list <br />");
students.sort();
students.displayItems();
document.write ("<br /> The Number of items REVERSED <br />");
students.reverse();
students.displayItems();
document.write("<br /> The last items is Removing from the array item 1 <br />");
students.pop();
students.displayItems();