Advertisement
fumanbest

Barcode Generator

Apr 5th, 2021
569
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function barcode(arr, marr) {
  2.     let start = Number(arr);
  3.     let end = Number(marr);
  4.     start_first = Number(Math.floor(start / 1000));
  5.     start_second = Number(Math.floor((start / 100) % 10));
  6.     start_third = Number(Math.floor((start / 10) % 10));
  7.     start_fourth = Number(Math.floor(start % 10));
  8.    
  9.     end_first = Number(Math.floor(end / 1000));
  10.     end_second = Number((Math.floor(end / 1000) % 10));
  11.     end_third = Number((Math.floor(end / 10) % 10));
  12.     end_fourth = Number(Math.floor(end % 10));
  13.  
  14.     for (let num_1 = start_first; num_1 <= end_first; num_1++) {
  15.         for (let num_2 = start_second; num_2 <= end_second; num_2++) {
  16.             for (let num_3 = start_third; num_3 <= end_third; num_3++) {
  17.                 for (let num_4 = start_fourth; num_4 <= end_fourth; num_4++) {
  18.                     if (num_1 % 2 !== 0 && num_2 % 2 !== 0 && num_3 % 2 !== 0 && num_4 % 2 !== 0) {
  19.                         console.log(`${num_1}${num_2}${num_3}${num_4}`);
  20.                     }
  21.                 }
  22.             }
  23.         }
  24.     }
  25. }
  26. barcode(2345,
  27.     6789);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement