const numberDivide = index / nums.length * 10;
// console.log(numberDivide);
for(let i = 0; i < numberDivide; i++) {
arrayCompare.push(total + numberDivide);
total += numberDivide;
}
// console.log(`arrayCompare ${arrayCompare}`);
for(let i = 0; i < nums.length; i++) {
let checkForNumbers = arrayCompare.includes(nums[i]);
// console.log(checkForNumbers);
if(checkForNumbers === false) {
arrayAnswer.push(nums[i]);
}
}
console.log(arrayAnswer);
return arrayAnswer;
}
/**
* Test Suite
*/
describe('extractEachKth()', () => {
it('returns largest positive integer possible for digit count', () => {
// arrange
const nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
const index = 3;
// act
const result = extractEachKth(nums, index);
// log
console.log("result: ", result);
// assert
expect(result).toEqual([1, 2, 4, 5, 7, 8, 10]);
});
});
function extractEachKth(nums, index) {
// write code here.
// console.log(nums);
// console.log(index);
const arrayCompare = [];
const arrayAnswer = [];
let total = 0;
let answer;