Suggest a feature
×

Welcome to TagMyCode

Please login or create account to add a snippet.
0
0
 
0
Language: Javascript
Posted by: Lelana villa
Added: Mar 23, 2018 7:43 PM
Views: 34
Tags: no tags
  1. var arr = [2, 2, 3, 4]
  2.  
  3. Array.prototype.first = function() {
  4. return this[0];
  5. }
  6.  
  7. console.log(arr.first()); // prints 1