Are you ready to become a professional web developer or programmer?
There are a few things you’ll want to learn when starting out with programming and launching your career in tech. One of those is learning your first programming language.
Choosing a first programming language is only important in order to get you encouraged and wanting to keep learning. What is not true about your first programming language is that it defines your programming career forever. Not at all.
Excited already? Why don’t we start right now?
Write this down yourself and hit enter:
You should see something similar to this:
The next thing we’ll want to do is to properly write code. The browser console is great for testing, but it’s simply not practical for larger projects.
What you’d need to do now is to download a text editor. This is a program that allows you to write code in an organized way, and it offers you syntax highlighting, as well as code completions functions, which are very useful.
You can download Visual Studio Code or Sublime Text 3, both cross-platform, the former free, and the latter has a license that never expires. If unsure, give Visual Studio Code, it’s modern, and has a great community.
Now, create a new file, and save it by pressing ctrl (or cmd) + s (save often!) and name it like you want, we’ll use first.js. The name doesn’t matter, just don’t use spaces, preferably, use dashes, and don’t forget the file extension .js, that’s how the browser and the text editor will know we are writing JS code.
Now, write the following code on first.js:
alert(“You’ll be very surprised”);
Alright, so, how do you run your first program? You might copy the code, and open the console on your browser to paste it there, and it will work! But that’s just not practical.
We are dealing with the web, and HTML is a fundamental language of the web. If you don’t know any HTML yet, don’t worry, it’s not hard to learn, and it will be hugely useful in your web development learning path.
For now, create a new file on your text editor as we did before, but this time call it index.html. It doesn’t have to be called index, but it’s a convention, and it’s good to adhere to coding conventions. Also, notice the file extension .html. Save this file along with first.js, in the same folder.
Write this down on index.html, it doesn’t matter if you don’t understand it yet:
Finally, get the path of your index.html file, either by manually looking for it, or by going to your text editor, right clicking on the file, and choosing Copy Path.
Now paste that past as if it was a URL on your browser, and enjoy.
Remember to make sure you understand the fundamentals, and happy coding!