AhmetUstun

04. Gifts from Santa

Nov 15th, 2020
193
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function santaHelper(n, m, s) {
  2.     let result = '';
  3.    
  4.     for (let i = m; i >= n; i--) {
  5.         if (i % 2 === 0 && i % 3 === 0) {
  6.             if (i === s) {
  7.                 break;
  8.             } else {    
  9.                 result += `${i} `;
  10.             }
  11.         }
  12.     }
  13.  
  14.     console.log(result);
  15. }
Advertisement
Add Comment
Please, Sign In to add comment