Skip to content

Commit 2ddd24e

Browse files
add 2619
1 parent d9fba9d commit 2ddd24e

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

Diff for: javascript/_2619.js

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
/**
2+
* @return {null|boolean|number|string|Array|Object}
3+
*/
4+
Array.prototype.last = function () {
5+
if (this.length === 0) {
6+
return -1;
7+
}
8+
return this[this.length - 1];
9+
};
10+
11+
/**
12+
* const arr = [1, 2, 3];
13+
* arr.last(); // 3
14+
*/

Diff for: paginated_contents/javascript/README.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
| # | Title | Solutions | Video | Difficulty | Tag
22
|------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------|--------------------------------------|------------------------------------------|----------------------------------------------------------------------
3-
| 2703 | [Return Length of Arguments Passed](https://leetcode.com/problems/return-length-of-arguments-passed/) | [Java](https://github.com/fishercoder1534/Leetcode/blob/master/javascript/_2703.js) | | Easy | Javascript
3+
| 2703 | [Return Length of Arguments Passed](https://leetcode.com/problems/return-length-of-arguments-passed/) | [Java](https://github.com/fishercoder1534/Leetcode/blob/master/javascript/_2703.js) | | Easy | Javascript
4+
| 2619 | [Array Prototype Last](https://leetcode.com/problems/array-prototype-last/) | [Java](https://github.com/fishercoder1534/Leetcode/blob/master/javascript/_2619.js) | | Easy | Javascript

0 commit comments

Comments
 (0)