Monday, March 26, 2012

FizzBuzz in Javascript

Joel and company probably won't hire me since he only gets rockstar developers but here is my attempt at FizzBuzz
<script>
    for(var i=1;i<=100;i++){
        if(i%3 != 0  && i%5 != 0)
            document.write(i);
        if(i%3 == 0)
            document.write('Fizz');            
        if(i%5 == 0)
            document.write('Buzz');                    
        document.write(' ');
    } //end for loop
</script>
I hope you found the post useful. You can subscribe via email or subscribe via a feed reader to get relevant updates from this blog. Have a nice day.

No comments:

Post a Comment