LOADING...

Preview

Pen ID
Unlock Campus Themeforest adv

 

Code
JS
/*
Write a function called "getElementsUpTo".

Given an array and a index, "getElementsUpTo", returns an array with all the elements up until, but not including, the element at the given index.

Notes:
* In order to do this you should be familiar with the 'slice' method.

var output = getElementsUpTo(['a', 'b', 'c', 'd', 'e'], 3) 
console.log(output); // --> ['a', 'b', 'c']
*/

function getElementsUpTo(array, n) {
  // your code here

}
Term
Wed, 12/27/2017 - 07:06

Related Codes

Pen ID
Pen ID
Pen ID
Square Adv