Some beginner question (JavaScript variable placement, Windows/Linux, etc)

Hello all,

am quite new to web development. Have done my first Vanilla JavaScript Tetris project (can’t put a link to it yet). But during the work I run into some questions, which could already be answered on this forum, but was not able to find them.
So let me begin:

  1. JavaScript variables.
    a) I have seen, that with ES6 there has been an introduction of let and const which supposedly are replacing the var. Is it tue?
    b) where should I decalre the variables? Till now I was doing it almost only at the beginning of the document, but I’ve heard, that it would be better to declare them just in front of the function or place where they will be first used.
  2. Would like to start as a front end and later go to full stack (also get in touch with AWS, but like in 4 months or even a bit later).
    a) Have heard, that a Mac is what I need for web development. Is it true?
    b) Is it enough to use Windows with Visual Studio Code on it and install in addition bash to it (instead of powershell)?
    c) I now use Windows. Would it be enough to install in addition to it a virtual machine with Ubuntu on it (like later on)?
    d) Should I switch immediately to ubuntu?
  3. Have heard that a community on like discord is a must. How can I join such a group?

Thanks in advance for your answers! :slight_smile:

1a. Yes. JavaScript has to be backwards compatible with older versions: the behaviour of var cannot be changed without breaking large chunks of the internet. So two new forms were created to fix problems with var. Unless you have a very good reason not to, use let and const. They should help prevent some common bugs. They behave more logically, so in theory are easier for a beginner (this in practise isn’t quite true, mainly because a. there are two and b. many explanations start off by illustrating how let/const are different to var). I say easier because you shouldn’t need to learn special var scoping rules. Normally it’s “if this let/const variable is part of a block of code inside curly brackets, it’s scoped inside those curly brackets”.
1b. What you’re talking about is normally going to mean global variables. Which is often bad for various reasons. But do what makes sense to you at the minute, declaring everything at the start is relatively common for very small games. In anything bigger it just makes it very difficult to hold on in your head what is going on at any one point in your program.
2a. Windows is fine. Linux is fine. Mac is fine. eg I think Mac’s are best for development because I have used a Mac for years. If I had used Windows or Linux my view would be different.
2b. Sure. Bash is kinda assumed to exist for many web dev tutorials/docs/etc. It’s trivial to install on Windows. Note your computer will have an entire Linux subsystem available to you for development purposes (Ubuntu by default but there’s a choice of distros).
2c. See last point. Sure, if you want to use Linux and have a graphic frontend for it so you can run graphical Linux apps rather than just CLI tools. But given Windows is drastically better in that regard, not really sure you’re going to get some huge benefit from using a system you’re unfamiliar with.
2d. I have Ubuntu on my personal laptop because I don’t like Windows for various reasons and I do like Linux for development. I haven’t used Windows for years though, which is mainly why I’d rather use something more familiar. If you know Windows I don’t really see the point.

1 Like