Sharp code


#1

wanted to find some other codes look nice like these.


for (var i = 1; i <= 20; i++){
    switch ({true:10, false:0}[i%3===0]+{true:1, false:0}[i%5===0]) {
        case 11:
            console.log('FizzBuzz');
            break;
        case 10:
            console.log('Fizz');
            break;
        case 1:
            console.log('Buzz');
            break;
        case 0:
            console.log(i);
            break;
    }
}


#2

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.