Advertisement
vasil_k_k

juniorJsRemainder

Jan 23rd, 2024
683
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function letterCombination(n) {
  2.     let charLetter = parseInt(n, 10);
  3.  
  4.     for (let i = 0; i <= charLetter; i++) {
  5.         for (let j = 0; j <= charLetter; j++) {
  6.             for (let k = 0; k <= charLetter; k++) {
  7.                 let firstLetter = String.fromCharCode(97 + i);
  8.                 let secondLetter = String.fromCharCode(97 + j);
  9.                 let thirthLetter = String.fromCharCode(97 + k);
  10.                 console.log(firstLetter, secondLetter, thirthLetter);
  11.             }
  12.         }
  13.     }
  14. }
  15. letterCombination("3")
  16.  
  17.  
  18. function countNumbers(endNumber) {
  19.     let counter = 0;
  20.     while (counter <= endNumber) {
  21.         console.log(counter);
  22.         counter++;
  23.     }
  24. }
  25. countNumbers(5);
  26.  
  27.  
  28. let testList = ["a", "b", "c", "d", "e"];
  29.  
  30. testList.sort((a, b) => {
  31.     if (a > b) return -1;
  32.     if (a < b) return 1;
  33.     return 0;
  34. });
  35.  
  36. for (let i = 0; i < testList.length; i++) {
  37.     console.log("Iterratiion", i);
  38.     console.log(testList[i]);
  39. }
  40.  
  41.  
  42. function guessTheName(name){
  43.     name.toLowerCase() === "vasil" ? console.log("Vasil") : console.log("Somebody else");
  44. }
  45. guessTheName("Vasil")
  46.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement