From c6f3b7ea2759de4752722aeb81f5f5e930d6814e Mon Sep 17 00:00:00 2001 From: "Kim A. Brandt" Date: Mon, 18 Dec 2017 14:43:20 +0100 Subject: [PATCH] Fix `nthElement'-example. --- snippets/nthElement.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/snippets/nthElement.md b/snippets/nthElement.md index 7e1799d24..ae472eb38 100644 --- a/snippets/nthElement.md +++ b/snippets/nthElement.md @@ -8,6 +8,6 @@ Omit the second argument, `n`, to get the first element of the array. ```js const nthElement = (arr, n=0) => (n>0? arr.slice(n,n+1) : arr.slice(n))[0]; -// nth(['a','b','c'],1) -> 'b' -// nth(['a','b','b']-2) -> 'a' +// nthElement(['a','b','c'],1) -> 'b' +// nthElement(['a','b','b'],-3) -> 'a' ```