Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* Write a program that prints the numbers from 1 to 100.
- But for multiples of three print “Fizz” instead of the
- number and for the multiples of five print “Buzz”. For
- numbers which are multiples of both three and five
- print “FizzBuzz” */
- Object.values([...Array(1e2).keys()].map(key=>['Fi','Bu'].reduce((acc,itr,idx)=>acc+((-~key%(idx*2+3))?'':`${itr}zz`),'')||-~key)).join('\n')
- [...Array(1e2)].reduce((s,l,k)=>s+(['Fi','Bu'].reduce((a,e,i)=>a+(-~k%-~(-~i<<-~{})?'':`${e}zz`),'')||-~k)+'\n','\n')
- (λ=>[...Array(1e2)].reduce((s,e,i)=>(s+((λ[-~-!(-~i%3)]+λ[-~!(-~i%5)])||-~i))+'\n',''))(['Fizz','','Buzz'])
- (λ=ǃ=>+!~-ǃ||λ(~-ǃ)+'\n'+((ǃ%3?'':'Fizz')+(ǃ%5?'':'Buzz')||ǃ))(100)
- (λ=ǃ=>+!~-ǃ||λ(~-ǃ)+'\n'+(['Fizz',''][ǃ%3&&1]+['Buzz',''][ǃ%5&&1]||ǃ))(100)
- (λ=n=>+!~-n||`${λ(~-n)}
- ${(`${n%3?'':'Fizz'}${n%5?'':'Buzz'}`||n)}`)(1e2)
- (λ=n=>+!~-n||λ(~-n)+'\n'+(['','Fizz'][+!(n%3)]+['','Buzz'][+!(n%5)]||n))(1e2)
- (λ=n=>+!~-n||λ(~-n)+'\n'+(['Fizz','',''][n%3]+['Buzz','','','',''][n%5]||n))(1e2)
- (λ=(ǃ,$=+!'')=>+!~-ǃ||λ(~-ǃ)+'\n'+((φ=>φ`Fizz`+φ`Buzz`)(Σ=>['',Σ][+!(ǃ%(-~((-~(++$&-~''))<<-~'')))])||ǃ))(1e2)
- [...Array(100).keys()].map(n=>['FizzBuzz',n,,,,,'Buzz',,,,'Fizz'][n**4%15])
- console.log((λ=ǃ=>+!~-ǃ||λ(~-ǃ)+'\n'+(['FizzBuzz',ǃ,,,,,'Buzz',,,,'Fizz'])[ǃ**4%15])(1e2));
- for (n=1;n<=100;++n) console.log(['FizzBuzz',n,,,,,'Buzz',,,,'Fizz'][n**4%15] + '\n');
- for (n=1;n<=100;++n) console.log(({0:'FizzBuzz',1:n,6:'Fizz',10:'Buzz'})[n**4%15] + '\n');
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement