finderabc

bankNumberGen

May 4th, 2018
48
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function bankNumberGen(m) {
  2.     let a = Number(m[0]);
  3.     let b = String(m[1]);
  4.     let c = String(m[2]);
  5.     let d = String(m[3]);
  6.     let e = Number(m[4]);
  7.     let n = Number(m[5]);
  8.     let validNumCounter = 0;
  9.    
  10.     for (let i = a; i <= 99; i++) {
  11.         for (let j = b.charCodeAt(0); j <= 'Z'.charCodeAt(0); j++) {
  12.             for (let k = c.charCodeAt(0); k <= 'z'.charCodeAt(0); k++) {
  13.                 for (let o = d.charCodeAt(0); o <= 'Z'.charCodeAt(0); o++) {
  14.                     for (let p = e; p >= 10; p--) {
  15.                         if (i % 10 == 2 && p % 10 == 5) {
  16.                             validNumCounter += 1;
  17.                         }
  18.                         if (validNumCounter == n) {
  19.                             console.log
  20.                             (`${i}${String.fromCharCode(j)}${String.fromCharCode(k)}${String.fromCharCode(o)}${p}`);
  21.                             return;
  22.                         }
  23.                     }
  24.                 }
  25.             }
  26.         }
  27.     }
  28. }
Add Comment
Please, Sign In to add comment