Advertisement
Spocoman

Letters Combinations

Feb 15th, 2022
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function lettersCombination(input) {
  2.     let x = input[0].charCodeAt(0);
  3.     let y = input[1].charCodeAt(0);
  4.     let z = input[2].charCodeAt(0);
  5.     let counter = 0;
  6.     let output = '';
  7.  
  8.     for (let i = x; i <= y; i++) {
  9.         for (let k = x; k <= y; k++) {
  10.             for (let j = x; j <= y; j++) {
  11.                 if (i !== z && k !== z && j !== z) {
  12.                     output += String.fromCharCode(i) + String.fromCharCode(k) + String.fromCharCode(j) + ' ';
  13.                     counter++;
  14.                 }
  15.             }
  16.         }
  17.     }
  18.     console.log(output + counter);
  19. }
  20.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement