Improved Advanced Code Solution (#22898)
This way it is less confusing + people should be aware of slice default arguments
This commit is contained in:
		
				
					committed by
					
						 Christopher McCormack
						Christopher McCormack
					
				
			
			
				
	
			
			
			
						parent
						
							6b2f72cae5
						
					
				
				
					commit
					d16c9b58fd
				
			| @@ -73,13 +73,13 @@ If you still can't figure out how to solve it with shift, then try solving it wi | ||||
| ##  Intermediate Code Solution: | ||||
|  | ||||
|     function dropElements(arr, func) { | ||||
|       return arr.slice(arr.findIndex(func) >= 0 ? arr.findIndex(func): arr.length, arr.length); | ||||
|       return arr.slice(arr.findIndex(func) >= 0 ? arr.findIndex(func): arr.length); | ||||
|     } | ||||
|  | ||||
|     // test here | ||||
|     dropElements([1, 2, 3, 4], function(n) {return n >= 3;}); | ||||
|  | ||||
|  <a href='https://repl.it/CLnc/0' target='_blank' rel='nofollow'>Run Code</a> | ||||
|  <a href='https://repl.it/repls/PositiveSandyObjectcode' target='_blank' rel='nofollow'>Run Code</a> | ||||
|  | ||||
| ### Code Explanation: | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user