Skip to content

Commit 9902bb4

Browse files
Add Array.findLast() demo.
1 parent e7ab147 commit 9902bb4

File tree

2 files changed

+25
-0
lines changed

2 files changed

+25
-0
lines changed

Diff for: queries/findLast.html

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<!doctype html>
2+
<!-- European Union Public License version 1.2 -->
3+
<!-- Copyright © 2025 Rick Beerendonk -->
4+
<html lang="en">
5+
<head>
6+
<meta charset="UTF-8" />
7+
<link rel="stylesheet" href="../resources/icons.css" />
8+
<link rel="stylesheet" href="../resources/oblicum.css" />
9+
<title>Find</title>
10+
11+
<script src="findLast.js"></script>
12+
</head>
13+
14+
<body>
15+
<div><span class="info">Open the console!</span></div>
16+
</body>
17+
</html>

Diff for: queries/findLast.js

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
/*! European Union Public License version 1.2 !*/
2+
/*! Copyright © 2025 Rick Beerendonk !*/
3+
4+
const arr = [1, 2, 3, 4, 5];
5+
6+
const lastEven = arr.findLast(x => x % 2 === 0);
7+
8+
console.log(lastEven); // 2

0 commit comments

Comments
 (0)