Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
First solution in Clear category for Easy Unpack by dbirmajer
import assert from "assert";
function easyUnpack(values: any[]): any[] {
// your code here
return [values[0], values[2], values[values.length - 2]];
}
console.log('Example:');
console.log(easyUnpack([1, 2, 3, 4, 5, 6, 7, 9]));
// These "asserts" are used for self-checking
assert.deepEqual(easyUnpack([1, 2, 3, 4, 5, 6, 7, 9]), [1, 3, 7]);
assert.deepEqual(easyUnpack([1, 1, 1, 1]), [1, 1, 1]);
assert.deepEqual(easyUnpack([6, 3, 7]), [6, 7, 3]);
console.log("Coding complete? Click 'Check' to earn cool rewards!");
Jan. 12, 2021
Comments: