Travis build: 1177 [cron]

This commit is contained in:
30secondsofcode
2019-05-29 15:51:46 +00:00
parent 9063fad13d
commit 0910152a4b
7 changed files with 20 additions and 16 deletions

View File

@ -668,8 +668,9 @@
"prefix": "30s_dropRightWhile",
"body": [
"const dropRightWhile = (arr, func) => {",
" while (arr.length > 0 && !func(arr[arr.length - 1])) arr = arr.slice(0, -1);",
" return arr;",
" let rightIndex = arr.length;",
" while (rightIndex-- && !func(arr[rightIndex]));",
" return arr.slice(0, rightIndex + 1);",
"};"
],
"description": "Removes elements from the end of an array until the passed function returns `true`. Returns the remaining elements in the array.\n\nLoop through the array, using `Array.prototype.slice()` to drop the last element of the array until the returned value from the function is `true`.\nReturns the remaining elements"