I’ve got this code in my Meteor app:
var step = Session.get(‘stepNum’),
step = (step) < 5 ? ++step : 1;
WebStorm’s inspection claims that both lines are duplicate declarations (telling me, “Duplicate declaration (at line 77)” and “Duplicate declaration (at line 78)”
Why? This is a common pattern, declaring a var and subsequently changing its value via further assignments.
Is WebStorm thinking that “var step” is a local var, and “step” is a global, or what and, if so, what is the proper way to do this in JavaScript/Meteor?