User blog comment:Jr Mime/How to Change/Add/Replace Masthead Tags (Such as Admin, Founder, Bot, etc...)/@comment-452-20141129155400/@comment-452-20141130125013

I'm familiar with Javascript, and Shining-Armor's example, but I'm not familiar with Jr Mime's example, and could find no javascript tutorials recommending that particular usage.

The reason I was asking is: why not simply use a semi-colon after each to avoid confusion? (Semi-colons would not work in Shining-Armor's example, but that is not what I am asking about.)

Alternatively, why are you only using commas there - why not also use commas between the other variable declarations?

I commonly just use semi-colons, and recognise that some people prefer to use commas, but I don't understand the inconsistency, and I'm assuming there is a purpose, which is why I am asking what the benefit is.

Each of these work: (I've removed the line-breaks to prove they work minified, since removing the semi-colons also works when line-breaks are present.)

var rights = {}; var admin = "admin"; var bureaucrat = "Bureaucrat"; var staff = "staff"; var vstf = "vstf"; rights['Someone is an admin'] = [admin]; rights['Someone else is an admin'] = [admin]; //semi-colons, with var before every variable. //This is how I normally would do it.

var rights = {}, admin = "admin", bureaucrat = "Bureaucrat", staff = "staff", vstf = "vstf"; rights['Someone is an admin'] = [admin], rights['Someone else is an admin'] = [admin]; //A semi-colon only when required, otherwise commas. //This is how I sometimes would do it.

rights = {}, admin = "admin", bureaucrat = "Bureaucrat", staff = "staff", vstf = "vstf", rights['Someone is an admin'] = [admin], rights['Someone else is an admin'] = [admin]; //omit all vars, and therefore another semi-colon //I try not to do it this way, because not a good practice: but it works.