Travis build: 1177 [cron]
This commit is contained in:
@ -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"
|
||||
|
||||
Reference in New Issue
Block a user