created by Brian LeRoux & Andrew Lunny. sparodically uncurated by David Trejo.

2013 02 22 parseint radix

    parseInt('fuck');     // NaN
    parseInt('fuck', 16); // 15

So remember kids, always supply a radix!

@kevincennis

This occurs because parseInt will continue parsing character-by-character until it hits a character it doesn't know. The f in fuck is hexadecimal

  1. You can get similar behavior with:
    parseInt('3fucks') // 3
    parseInt('3fucks', 16) // 3f in hex = 63
    
Fork me on GitHub