---
title: "Comment by nichromat on \"Most common mistakes of (not only) JavaScript developers\" | Hashnode"
description: "Such a great post!! Although, as a beginner in web dev. I have some questions: Not using var , let , or const to declare variables I didn&#39;t know that by not"
url: "https://hashnode.com/posts/most-common-mistakes-of-not-only-javascript-developers/6274b4baf24a8e4867f926b8/comment/62751d5450c6035691e2aa58"
---

[Discussion](https://hashnode.com/posts/most-common-mistakes-of-not-only-javascript-developers/6274b4baf24a8e4867f926b8)

Comment [Most common mistakes of (not only) JavaScript developers](https://hashnode.com/posts/most-common-mistakes-of-not-only-javascript-developers/6274b4baf24a8e4867f926b8)

[May 6, 2022](https://hashnode.com/posts/most-common-mistakes-of-not-only-javascript-developers/6274b4baf24a8e4867f926b8/comment/62751d5450c6035691e2aa58)

Such a great post!!

Although, as a beginner in web dev. I have some questions:

> Not using `var`, `let`, or `const` to declare variables

I didn't know that by not using these keywords, variables would become global. But, doesn't `var` make a variable global?

> Using JavaScript for everything

Do you mean, using JavaScript for Front-end vs Back-end?

[Tomek Skupiński](https://hashnode.com/@focusinsky)

[May 6, 2022](https://hashnode.com/posts/most-common-mistakes-of-not-only-javascript-developers/6274b4baf24a8e4867f926b8/comment/62751d5450c6035691e2aa58#reply-62752f02317fc95a74ca5f75)

Thanks, really glad you liked it 😊

As for the first one:

When you are in global scope there is no difference between using `var` and not using any keyword to declare a variable. But if you declare a variable without a keyword (`var`, `let`, or `const`) it becomes available globally no matter when you declare it. Let's look at some examples.

```
function exampleFunction() { 
  var baz = 10;
};
printSomething();

console.log(baz);
```

Will throw a `ReferenceError` because we want to `console.log` variable which was declared within the scope of function.

But if we won't use `var` keyword like here:

```
function exampleFunction() { 
  bar = 10;
};
exampleFunction();

console.log(bar);
```

It will print out `10` because `bar` is globally available.

Hope it helps. Also, you should use `let` instead of `var`, I mentioned `var` because it is still part of syntax but `let` or `const` are recommended.

[Tomek Skupiński](https://hashnode.com/@focusinsky)

[May 6, 2022](https://hashnode.com/posts/most-common-mistakes-of-not-only-javascript-developers/6274b4baf24a8e4867f926b8/comment/62751d5450c6035691e2aa58#reply-6275307d317fc95a74ca5fd7)

As for the latter. Often people recommend JavaScript as a language you can use to build everything (frontend, backend, games, mobile apps, machine learning, etc.), and while it is true usually there are better tools for the job.

The only area where JavaScript is really needed and it is hard to find something better is frontend development. In other fields, there are tailored made tools that usually will make the development experience better. I am building my backends with Ruby on Rails and it is much faster, easier, and more pleasant to work with than node.

It doesn't mean you shouldn't use it in other areas if you are just starting but I always encourage people to look for the proper tools for the job. Getting dirty with different technologies can really help you grow.

That said if you are just starting sticking to one language is the best strategy, just keep in mind that in the future it might be cool to see what other tribes have to offer.

[nichromat](https://hashnode.com/@nichromat)

[May 6, 2022](https://hashnode.com/posts/most-common-mistakes-of-not-only-javascript-developers/6274b4baf24a8e4867f926b8/comment/62751d5450c6035691e2aa58#reply-62753195dc122f5a4f21c2fb)

[Tomek Skupiński](https://hashnode.com/@focusinsky) Now I understand. JavaScript can be such a mess 😅

> Using JavaScript for everything

What about his point? What were you referring to?

[Tomek Skupiński](https://hashnode.com/@focusinsky)

[May 6, 2022](https://hashnode.com/posts/most-common-mistakes-of-not-only-javascript-developers/6274b4baf24a8e4867f926b8/comment/62751d5450c6035691e2aa58#reply-6275326f317fc95a74ca6000)

[nichromat](https://hashnode.com/@nichromat) I have added the answer above 😊 Sorry for splitting it into two posts.

[nichromat](https://hashnode.com/@nichromat)

[May 6, 2022](https://hashnode.com/posts/most-common-mistakes-of-not-only-javascript-developers/6274b4baf24a8e4867f926b8/comment/62751d5450c6035691e2aa58#reply-6275330f317fc95a74ca6009)

[Tomek Skupiński](https://hashnode.com/@focusinsky) Oops, I didn't see it. Thank you very much for your answers. Good luck 😸

[Tomek Skupiński](https://hashnode.com/@focusinsky)

[May 6, 2022](https://hashnode.com/posts/most-common-mistakes-of-not-only-javascript-developers/6274b4baf24a8e4867f926b8/comment/62751d5450c6035691e2aa58#reply-627533f1dc122f5a4f21c328)

[nichromat](https://hashnode.com/@nichromat) No worries, hit me if you will have any other questions or would like to talk about something code-related. Have a good weekend.
