Advertisement
Guest User

Untitled

a guest
Mar 21st, 2018
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.62 KB | None | 0 0
  1. let array = [2, 4, 1, 2, 3, 4, 5, 6, 7];
  2. let factors = [];
  3. let final = [];
  4. let total = 0;
  5.  
  6. function getFactors() {
  7. array.forEach((number) => {
  8. let i = array.indexOf(number);
  9. let factor[i] = array[i] + 1;
  10. });
  11. };
  12.  
  13. getFactors().then(function{
  14. array.forEach((number) => {
  15. let i = array.indexOf(number);
  16. final[i] = array[i] * factor[i];
  17. });
  18.  
  19. function check() {
  20. final.forEach((number) => {
  21. let i = array.indexOf(number);
  22. total = total + final[i];
  23.  
  24. if (total/11 % != 0) return console.log("Error.");
  25. console.log("Check successfully completed.");
  26. });
  27. }
  28.  
  29. check();
  30. // by fred
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement