Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit2ddd24e

Browse files
add 2619
1 parentd9fba9d commit2ddd24e

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

‎javascript/_2619.js

Lines changed: 14 additions & 0 deletions
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+
returnthis[this.length-1];
9+
};
10+
11+
/**
12+
* const arr = [1, 2, 3];
13+
* arr.last(); // 3
14+
*/
Lines changed: 2 additions & 1 deletion
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)

[8]ページ先頭

©2009-2025 Movatter.jp