Fulton Browne Posted on Mar 10, 2020 What is the equivalent of a static variable in JS #explainlikeimfive #help #javascript #java I am starting to get my feet wet with js, I am wondering is there an equivalent to Java static variable in node js. Top comments (5) Subscribe Submit Preview Dismiss Collapse Expand Ben Lovy Ben Lovy Ben Lovy Follow Just this guy, you know? Email ben@deciduously.com Location Boston, MA, USA Education Currently enrolled @ Champlain College Online Work Rust Developer @ Tangram.dev Joined Mar 19, 2018 • Mar 10 '20 • Edited on Mar 10 • Edited Dropdown menu Copy link Hide Doesn't Node support the ES6 class syntax? I think you can just do exactly what you want. Collapse Expand Fulton Browne Fulton Browne Fulton Browne Follow I am a developer trying to change the world with code. Email fultonbrowne@pm.me Location Birmingham, Alabama Education Student at Samford University Pronouns He/Him Work Senior sofware engineer at Neonaut Joined Jun 7, 2019 • Mar 10 '20 Dropdown menu Copy link Hide wow didn't know it was that easy, thanks! Collapse Expand Ben Lovy Ben Lovy Ben Lovy Follow Just this guy, you know? Email ben@deciduously.com Location Boston, MA, USA Education Currently enrolled @ Champlain College Online Work Rust Developer @ Tangram.dev Joined Mar 19, 2018 • Mar 10 '20 Dropdown menu Copy link Hide Classes in ES6+ are really just syntax sugar, so I don't think this actually answers your question in quite the right spirit, but it is a feature you can use :) Raghav Misra Raghav Misra Raghav Misra Follow Email raghav.m2014@gmail.com Joined Sep 19, 2019 • Mar 10 '20 Dropdown menu Copy link Hide I 100% agree with you Ben, but if a feature is there, might as well use it, right? Matthew Bramer Matthew Bramer Matthew Bramer Follow https://about.me/iOnline247 Joined Dec 8, 2019 • Mar 12 '20 Dropdown menu Copy link Hide with and eval are features too. You might be better off looking into how functional programming can solve the problem you're solutioneering. Code of Conduct • Report abuse
Top comments (5)
Doesn't Node support the ES6 class syntax? I think you can just do exactly what you want.
wow didn't know it was that easy, thanks!
Classes in ES6+ are really just syntax sugar, so I don't think this actually answers your question in quite the right spirit, but it is a feature you can use :)
I 100% agree with you Ben, but if a feature is there, might as well use it, right?
withandevalare features too. You might be better off looking into how functional programming can solve the problem you're solutioneering.