fbpx

 

Javascript is a language used to determine how webpages behave.

Here is a comprehensive guide that will help you to understand the basics of Javascript.

We will do our best to cut learning fluff, and update the guide based on your input.

 

Etymology

Javascript is a dynamically typed scripting language.

The reason ‘Java’ is present within the language’s name is a bit of a mystery to us.

We speculate that the founders of Javascript enjoyed Java beverages, and made a pun on this when naming Javascript.

Javascript shares no explicit relation with the programming language Java.

 

Usage

Javascript is used alongside HTML and CSS for basic web development.

Photo Credit: W3Schools

Additionally, it has a vast array of powerful libraries (examples: jQuery, D3, React, etc.) and development stacks (example: MEAN).

At the time of writing this article, Javascript is on of the most used programming languages in the world.

 

Syntax

Photo Credit: W3Schools

Javascript uses literals and variables.

Literals are numbers and strings.

Number = 0, 1, 2, 3, 4, 5, 6, 7, 8, 9

String = ABCDEFGHIJKLMNOPQRSTUVWXYZ

Variables are numbers and strings that are assigned values using keywords and operators. The keyword ‘var’ and the operator ‘=’ are commonly used to assign values to variables.

Expressions are combinations of the above.

 

Statements

Statements in Javascript end with a semicolon.

Note: Javascript is a language that ignores white spaces. This means that something like ‘hello’ is acceptable to write.

Photo Credit: W3Schools

 

Operators

Standard operators in Javascript are:

= which is used to assign a value.

== which is used to state one value is ‘equal to’ another value.

< which is used to state one value is ‘less than’ another value.

> which is used to state one value is ‘greater than’ another value.

<= which is used to state one value is ‘less than or equal to’ another value.

>= which is used to state one value is ‘greater than or equal to’ another value.

| which is used for ‘OR’ comparisons.

Photo Credit: W3Schools

 

Functions

Functions help you to do a lot of fun stuff in Javascript.

The keyword ‘function’ is used to defines a function.

The steps of a function are housed within curly braces

The steps in a function are collectively called an algorithm.

 

Methods

Methods allow you to manipulate objects in Javascript.

Methods can be applied to numbers and strings.

Common Methods for Numbers:

1) valueOf()

2) parseInt()

3) parseFloat()

4) Number()

5) toString()

Commons Methods for Strings

1) search()

2) slice()

3) replace()

4) toUpperCase()

5) toLowerCase()

NOTE: Methods are also applied to arrays. We will examine how in a future guide.

 

What is JSON?

JSON is a file format that allows for information exchange between a server and a client. Javascript can be converted into JSON so that information can be transmitted to a server.

A client can send information to a server using the method JSON.stringify()

A client can receive information from a server using the method JSON.parse()

 

What is AJAX?

AJAX is an acronym for Asynchronous Javascript and XML. It allows developers to update their web pages without reloading the page. Different platforms put in place AJAX in different ways.

 

What Libraries and/or Frameworks should I learn?

Libraries for beginners:

1) React

2) Material-UI (for React)

3) jQuery

4) D3js

 

Frameworks

Do not learn a Javascript framework if you are a beginner.

If you are intermediate with your Javascript skills then we recommend learning Angular.

This topic we will cover this topic in future blog posts.

 

Javascript and Mobile Development

Some technologies allow users to create mobile applications using Javascript. Two examples of this are React Native and Nativescript. We will cover mobile development using Javascript in a future article.

 

Avanka IT Tips on Javascript

1) Be careful when you define variables. For example, you may have to load integers that you assigned as variables earlier on in your code. This may cause conflicts if you are not careful, and is a big mistake beginners make.

2) Refrain from defining global variables.

3) Use the === and !== to compare variables. This helps to make your code cleaner.

 

Conclusion

Javascript is the core of many web applications. It is flexible, powerful, and a fun programming language to learn. We recommend all programmers learn Javascript both for is practical and recreational uses.

 

A Quick Request

Please share this article on your social media feeds if you found it useful.

Contact us anytime if you would like us to write about a particular topic or want to improve your coding skills.

 

References

Avatar

Author: Suren Dias

Inheritor of an IT firm in Sri Lanka who is passionate about creating socially beneficial, mutually profitable, and enjoyable business partnerships. Please feel free to contact me anytime if there’s something I could assist you with.

Sign Up For Our Blog

Join our mailing list to receive the latest news and updates from our team.

You Have Successfully Subscribed!