Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
Alex A. Naanou 2020-09-09 22:14:52 +03:00
parent 505a228a03
commit 6db5d0c4f8

View File

@ -64,12 +64,16 @@ Array.prototype.includes
// first/last element access short-hands... // first/last element access short-hands...
// //
// .first() // .first()
// .last()
// -> elem // -> elem
// //
// .first(value) // .first(value)
// .last(value)
// -> array // -> array
// //
// // NOTE: setting a value will overwrite an existing first/last value.
// NOTE: for an empty array both .first(..)/.last(..) will return undefined
// when getting a value and set the 0'th value when setting...
Array.prototype.first Array.prototype.first
|| (Array.prototype.first = function(value){ || (Array.prototype.first = function(value){
return arguments.length > 0 ? return arguments.length > 0 ?