DEV Community

Cover image for Feeling like VAR in a LET (it go) kinda world.

Posted on

Feeling like VAR in a LET (it go) kinda world.

I've just scraped by Week 3 of web dev coding bootcamp, and it feels like the moment that I set my intention on embarking on this new learning journey, the Universe has been sending a whole slew of new hurdles and distractions along my pathway.

From the tumultuous experience of moving into my first NYC studio apartment while simultaneously juggling acclimating to a new environment and attempting to set healthy routines, to navigating the conflicting internal emotions of an unexpected loss and being physically and emotionally available for family and loved ones -- I can assert that the past 4 weeks have been the most eventful in this post-COVID world. (I've finally dusted off my mainly unused 2020 planner and flipped through all of the blank template pages to October!)

Last week, we learned about conditionals and debugging in JS, as well as loop iterations using for and while.

While learning about the dark perils of endless debugging, I found it interesting that many peers and my instructor in the cohort were discussing the 80/20 rule of debugging, which states that "Coding is 80% Google Search, and 20% knowledge".

While this may be true, I also learned that you must also know WHAT information to search for and use on Google, as I learned this sobering lesson from my coding instructor via our team #slack channel;

"I will no longer be accepting assignments that use VAR. We need to LET go of VAR and use LET and CONST."#

Now this unsettled me for a bit, because a large amount of the online resources that I've been practicing with, including FreeCodeCamp, posts I've referenced and copied on StackOverflow, and physical books (yes, I'm still old-school and prefer real tangible books over digital devices.) that I've purchased on JavaScript, all use VAR.

I was confounded... How is it that I've just started and the information that I've been learning from, is already out of date?

My instructor shared with us that languages are always evolving, and although physical books may be helpful for a season, it's important to get in the habit of referencing digital documentation and digital living textbooks.

I now understand that let can be used for global and local variables, and const can be used for variables that are not going to be manipulated or changed (i.e. const pi = 3.14159;)

It got me thinking on a broader scope of my life in general, I have a choice. I can either be bitter and complain about new technology and be stuck in my ways, or I can be flexible, open and adapt to the ever evolving and changing climate of tech.

I decided... it's time to LET it go.

Top comments (3)

mse99 profile image
Mohamed Edrah

Just stick to it, you made it this far, you'll pull through :D. also var is still useful it's one of the easier (and i would argue semantic) ways to declare globals inside of scripts just by simple declaring a variable in the top level scope of your JavaScript, people hate var because it has some flaws (which is understandable).

if you get a job in the industry and you had to maintain legacy code bases there's a huge chance that you'll have to work with var at some point.

One book series that i learned a lot from was called You Don't Know JS by Kyle Simpson, this is my favorite programming book series and they're the best source to learn JS IMO and it's free online on Github.

Good luck.

blaquebeardcoder profile image

Mohamed thank your kindly for taking time to respond to my post and share some new insights into the history of VAR. You are also the second person this week to recommend "You Don't Know JS" -- so I'm going to make that a priority for my continued learning!

Thanks again!

_michaelnunez profile image
Michael Nunez

My rule of thumb is:

Always use const until you cannot, then, use let

My other rule is:

Never use let lol