Cover photo by Irvan Smith on Unsplash
The JavaScript programming language is one of the cornerstone technology of the web alongside HTML and CSS. JavaScript is mainly used to add behavior to web pages like animations and dialog boxes but, over the years its usage has eclipsed "adding behaviors to web page" and it's now used to create fully fledged UI using tools like ReactJS and VueJS and you can also find JavaScript on the server side in the form of NodeJS.
JavaScript like most programming languages is a tool in a developers toolkit and like all tools, it is used to solve programming problems or tasks if it fits the specific domain. Our domain of interest in this section of the series is the WWW or the web for short and JavaScript fits nicely because it was originally designed for the web.
It is quiet easy to get started with JavaScript with so many resource on the internet most notably MDN and as you go deeper in learning JavaScript you will realize its quiet a forgiving language and beginner friendly and it contains some features that'll do some house keeping for you like automatic semicolon insertion.
If you read the the previous paragraphs and you wonder why i mentioned ReactJS, VueJS and automatic semicolon insertion, take a deep breath and exhale. How do you feel? I hope you feel better. You should not worry much because we wont get that deep while learning JavaScript in this section and moreover this is an introduction.
The JavaScript we'll discuss are just the basics to get you started, we'll talk about the following (and more):
- Variables
- Arrays
- Objects
- Functions
- Conditional Statements
The list above is just some of the things you'll find in most high level programming languages and we'll discuss them in a way you can easily digest them.
Furthermore, our discussion we'll focus mainly on using JavaScript on a web page and we'll talk about the DOM and how to manipulate it using API's like:
We'll also talk about Ajax and our main coding environment will be the Developer Tools and your favorite text editor.
Beginner related questions
The following are questions commonly asked by beginners getting started with JavaScript.
Question: What is JS?
Answer: JS is short for JavaScript.
Question: Is JavaScript the same as Java?
Answer: No. JavaScript is not the same as Java and both language have different syntax and uses.
Question: Can you mention one main difference between both languages?
Answer: JavaScript is an interpreted language and Java is a compiled language.
Question: If i know JavaScript can i easily pick up Java?
Answer: It depends on your learning capabilities and if the project you are working on requires Java. But, I'll advise you to learn a language only if you have a project that you want to implement and of one its requirement is to learn the language.
With this you will be learning with a purpose which is one of the best way to learn because every time you are learning parts of the language you will be thinking about how to apply it to your project and when you do, there is a high chance you wont forget what you've learned and you will have an experience on the implementation details which is an added bonus.
Question: How can i save my JavaScript file?
Answer: With the .js
extension.
But, before we start coding lets take a look at some history lesson. That's next.