On assigning variables I maintain only one space on each side of ‘=’ operator. Like in the following way.
var $a = 1; var $b = 2; var $extra = 3;
But I saw my fellow programmer maintaining a tab before the ‘=’ to make it vertical aligned. Like in the following way
var $a = 1; var $b = 2; var $sum = 3;
Which one of the above is proper way to be followed and why?
There is no proper way to be followed. Do whatever you feel makes the code easier to read.
The only rule I’d follow is to maintain whatever conventions are already there.