Created
May 7, 2011 22:33
-
-
Save mason-stewart/960916 to your computer and use it in GitHub Desktop.
How many of them there Micro libraries are there?!
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Run this in the console at http://microjs.com to see how much it would weigh if you used 'em all! ;D | |
var theSizes = document.getElementsByTagName("div"); | |
var total = 0; | |
var incorrectClass = 0; | |
var i = theSizes.length; | |
var current; | |
while (i--) { | |
if ( theSizes[i].className == "size" ) { | |
current = theSizes[i].innerHTML; | |
total += parseFloat(current.substring(0, current.length -1)); | |
} else { | |
incorrectClass ++; | |
} | |
} | |
console.log(theSizes.length - incorrectClass + " micro frameworks & libraries weighing an underwhelming total of " + total.toFixed(1) + "k!") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment