From 5b9eae2b4fc06fc483e695afd8d7c227655ad5fe Mon Sep 17 00:00:00 2001 From: Siarhei Date: Fri, 11 May 2018 16:18:35 +0400 Subject: [PATCH] Fix findLast docs code --- snippets/findLast.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/snippets/findLast.md b/snippets/findLast.md index 1a3ae39b6..911177269 100644 --- a/snippets/findLast.md +++ b/snippets/findLast.md @@ -5,7 +5,7 @@ Returns the last element for which the provided function returns a truthy value. Use `Array.filter()` to remove elements for which `fn` returns falsey values, `Array.pop()` to get the last one. ```js -const findLast = (arr, fn) => arr.filter(fn).slice(-1)[0]; +const findLast = (arr, fn) => arr.filter(fn).pop(); ``` ```js