Add method to array to get last element - Node.js Array

Node.js examples for Array:Last Element

Description

Add method to array to get last element

Demo Code


Array.prototype.last = function() {
    return this[this.length-1];
}

Related Tutorials