Created
December 31, 2013 13:24
-
-
Save vukicevic/8196762 to your computer and use it in GitHub Desktop.
Calculate length, in bytes, of input number. JavaScript.
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
function byteLength(l) { | |
return Math.floor(Math.log(l)/Math.log(256))+1; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment