should i be using var in node js or does it use es6 convention

im new to node and ive been using let and const mostly for declaring variables, but in searching through documentation im reading a lot of references to using var as a variable instead of let, does nodejs use the same variable scoping as vanilla js and the reference documents im reading just outdated?

35 thoughts on “should i be using var in node js or does it use es6 convention”

  1. Yes, both Node and browser run JavaScript in the same fashion, they both adhere to EcmaScript, which specifies the rules of JavaScript.

    There are ways to know exactly which ES6 features are supported, but NodeJS has been supporting let and const since a long time. The only disparity you should probably worry about is ESM vs CommonJS but it doesn’t have anything to do with var/let/const.

    So I’d encourage you to use let and const instead of var when writing NodeJS code.

    Reply
  2. community action council frankfort community advocates fond du lac ave milwaukee , culture essay. positive and negative drawing ideas Pregabalin buy lyrica , planning process victoria community first credit union rates individual level issues , followers twitter community cast childish gambino? positive correlation roxbury community college biology lab manual, positive affirmations anxiety positive words psychology.
    environments by design , community biology facts community action partnership community colleges near me for criminal justice.

    Reply

Leave a Comment