Ranter
Join devRant
Do all the things like
				++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
				Sign Up
			Pipeless API
 
				From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
				Learn More
			Comments
		
- 
				
				Just when I thought I've understood JavaScript😫 .... baNaNa! .... This z just crazy!!!
- 
				
				('b' + 'a' + + 'a' + 'a').toLowerCase()
 
 + 'a' is NaN
 ('b' + 'a' + NaN + 'a').toLowerCase()
 
 everything gets casted to string and concatenated
 
 ('baNaNa').toLowerCase()
 
 banana
 
 js's type handling is kind of nuts. Try the following
 
 []+{}*[]+[]+{}*[]+[]+{}*[]+[]+{}*[]+[]+{}*[]+[]+{}*[] + " batman!"
- 
				
				For those who would like explanation, taken from https://freecodecamp.org/news/...
 
 Unary + operator has higher precedence over binary + operator. So essentially what it does is:
 
 ('b'+'a'+ (+'a') + 'a').toLowerCase();
 
 Unary plus triggers numeric conversion for string 'a'. Since the string does not represent a valid number, the result is NaN. On the next step, expression 'ba' + NaN + 'a' is evaluated.










 This never gets old...
This never gets old...
 Exactly
Exactly
 ¯\_(ツ)_/¯
¯\_(ツ)_/¯
Javascript why? (-‸ლ)
joke/meme
sarcasm is life
javascript