Coding Newbie

javascript, programmer, code-4523100.jpg

What is JavaScript? Complete Beginners Guide

JavaScript is one of the most popular and used programming languages in the world. But, what is JavaScript? And why is it so important today?

The use of JavaScript grows every day, and many world companies such as Netflix and PayPal, have built their internal applications around JavaScript. Learning JavaScript is a great opportunity to land a high paying job. In addition, JavaScript is found both in Front-end developing, as well as in Back-end development.

man, thinking, doubt-javascript.jpg

Whenever you see some dynamic change on the website, you are witnessing the power of JS. Changing of colors, animation effects on mouse scroll, events on click, are just some examples of the use of JavaScript.

Is JavaScript a programming language?

Yes, JavaScript is actually a programming language.

Unlike HTML and CSS, which we define as markup languages, JavaScript as a programming language supports manipulation of objects. This allows us to create much needed dynamics on our websites, and produce effects that are just not possible to make with only HTML and CSS.

Is it used only for building websites?

With years, JS has surpassed its original use, and today we can use this programming language to build web and mobile applications, networking apps like chats and streaming services, video games, and much, much more.

JavaScript was initially designed to run only in web browsers. Every browser has a JS engine, and can execute JavaScript code. Ryan Dahl embedded JavaScript Chrome engine into C++ program, and created the language called Node. That allowed running JavaScript code outside the browser, which enabled using JavaScript for back-end development of mobile and web applications.

How can we add JavaScript to our website?

There are two ways to add JavaScript code to your website:

  • Internal
  • External

Internal adding of JavaScript is adding JavaScript directly into HTML file, while external way means keeping your JS code in a separate file.

If you wish to learn about how to implement JavaScript code and which way is better, please feel free to read it here.

What are some attributes of JavaScript syntax?

If you use internal way to write JavaScript, you place code within <script> and </script>tags in HTML file. If you use external method, there is no need to add <script> tags at all.

When writing JavaScript code, you should be aware of several important properties of JS syntax.

JavaScript is a case sensitive language.

This means that you have to be careful with variable names, function names, object names, etc. Variable named button is different from Button variable.

JavaScript requires the use of identifiers.

An identifier is a name you use for a declared variable, function, array, object, or any other parameter.

Your identifier name must follow two rules:

  • The characters that you can use are letters (a-z, A-Z), numbers (0-9), underscores (_), and dollar signs ($).
  • The first character can not be a number (0-9).

Semicolons are optional in JavaScript. If you skip to add a semicolon, and each of your statements are placed on a separate line, it will not affect the end result.

Note: It is highly recommended to use semicolon anyway, because it will make your code more readable and prevent potential errors.

JavaScript ignores spaces, tabs, and lines.

You can make spaces, new lines, and indent the code as you wish. It will not affect your code, but can make it more easy to read.

JavaScript supports both single-line and block comments.

If you want to use single line comment, you use two forward-slash characters // .

For block comments, you use a forward slash and asterisk /* and ends with the opposite sign */ .

Furthermore, JavaScript also recognizes the HTML comment opening tag <!– and it will treat it like a single line comment. In JavaScript you do not have to put closing tag like in HTML.

JavaScript language has reserved keywords.

The reserved words will not be available to use for identifiers, because these words have a predesigned use in JavaScript.

abstractargumentsawaitboolean
breakbytecasecatch
charclassconstcontinue
debuggerdefaultdeletedo
doubleelseenumeval
exportextendsfalsefinal
finallyfloatforfunction
gotoifimplementsimport
ininstanceofintinterface
letlongnativenew
nullpackageprivateprotected
publicreturnshortstatic
superswitchsynchronizedthis
throwthrowstransienttrue
trytypeofvarvoid
volatilewhilewithyield
List of reserved JavaScript words

How long does it take to learn JavaScript?

Although JavaScript is a relatively easier programming language in comparison to other languages, and the programming language you should start with, it is the language that constantly evolves and updates. That is why it is important to stay ahead of the curve and be up to date with new features.

Learning JavaScript puts you in a programming state of mind, because it teaches you how to think like a programmer, which is the first step in programming world.

Most programmers will state that learning JavaScript will take several months to learn basic, and around 9 months to be comfortable with it. It is a language with increasing demand, and it is definitely worth learning.

Conclusion

JavaScript is undoubtedly one of the most widely used programming languages today and certainly a language in demand.

JavaScript is the language that provides interactivity to your websites, and much wanted dynamics, something that was possible to achieve solely with using HTML and CSS.

It is a language that constantly evolves and today we can use it to build web and mobile applications, networking apps like chats and streaming services, video games, and much, much more.

%d bloggers like this: