Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- let array = [2, 4, 1, 2, 3, 4, 5, 6, 7];
- let factors = [];
- let final = [];
- let total = 0;
- function getFactors() {
- array.forEach((number) => {
- let i = array.indexOf(number);
- let factor[i] = array[i] + 1;
- });
- };
- getFactors().then(function{
- array.forEach((number) => {
- let i = array.indexOf(number);
- final[i] = array[i] * factor[i];
- });
- function check() {
- final.forEach((number) => {
- let i = array.indexOf(number);
- total = total + final[i];
- if (total/11 % != 0) return console.log("Error.");
- console.log("Check successfully completed.");
- });
- }
- check();
- // by fred
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement