DEV Community

Cover image for Stop Using the var Keyword!
Michael Jolley
Michael Jolley

Posted on

Stop Using the var Keyword!

Top comments (5)

Collapse
 
michaeltharrington profile image
Michael Tharrington

Haha, lovin' how ya describe the folks who use var everywhere as "varriors" — that's gonna stick with me.

Collapse
 
blazingbits profile image
BlazingBits • Edited

I'm not sure his argument of "varriors" being lazy is the hill he wants to die on when his entire argument is that he's too lazy to just go see what the type a method returns is, or to just look to the right side of an ='s sign...

Collapse
 
michaeljolley profile image
Michael Jolley

The argument wasn't "varriors are lazy." Those are two different segments I mentioned.

The argument was it would take a few more "CPU cycles" to write the explicit type, but less "CPU cycles" to read for everyone afterward.

Collapse
 
blazingbits profile image
BlazingBits

On top of that, if your editor doesn't have type hints then you need a new editor

Collapse
 
michaeljolley profile image
Michael Jolley

Not everyone who is looking at code is using an editor.

PR reviews, etc. could and sometimes frequently are happening in the browser without hinting or hovering.