In IT, what many developers mistakenly consider to be magic code or evidence of elite (aka "L337") hacker-type abilities actually turns out to just be some cleverly applied math concocted by a developer who chose to think outside of the box.

Take into consideration the following code that Piotr Kaminski submitted. I have no doubts that it validates user information just fine, but the fact that it does so by adding booleans and division is a new one for me.

proFormComplete = function(){
  var u = user.getUser();
  var ct = 0 + (typeof(u.nickname)==='string' && u.nickname.length>0) +
    (typeof(u.websiteUrl)==='string' && u.websiteUrl.length>0) +
    (typeof(u.linkedin)==='string' && u.linkedin.length>0) +
    (typeof(u.locationString)==='string' && u.locationString.length>0) +
    (typeof(u.title)==='string' && u.title.length>0) +
    (typeof('string' &&>0) +
    (typeof(u.imageUrl)==='string' && u.imageUrl.length>0) +
    (typeof(u.resume)==='string' && u.resume.length>0) +
    (u.employerSharing && true);
  return Math.ceil(ct/0.09);
[Advertisement] BuildMaster allows you to create a self-service release management platform that allows different teams to manage their applications. Explore how!