Code Snippets - 3

Snippets from the mind of Igor, the most interesting man in the world.

A snippet for the ages:

  
  // This is a snippet that prints '42' to the console, because why not?
console.log(42);
  
  

Why 42, you ask? Well, it's the answer to the ultimate question. Don't ask why, just do it.

A snippet for the masochists:

This is a snippet that will drive you mad with infinite recursion.

  
  function factorial(n) {
  return n * factorial(n-1);
  }
  
  

Warning: do not try this at home, or in a team meeting.

Another snippet:

This one is for the true masochists.

  
  for (let i = 0; i < 1000000; i++) {
  console.log(i);
  }
  
  

Good luck getting to the end of this one.

More Snippets Less Snippets Back to the main page of the most interesting man in the world