JavaScript 101: Ultimate JavaScript Guide
Tags: frontend, beginners, webdev, javascript
Published: 2022-08-02 00:15:00

Javascript is a scripting language that works alongside HTML and CSS to enhance code functionality and add interactive elements. It can be embedded in HTML using the <script> tag and is an interpreted language, which means it is not compiled.
As a beginner, the best approach to JavaScript would be to understand its basic building blocks. Here goes:-

JavaScript Variables
A variable is a container in which you place any literal value into, or assign it to represent an object that you have created.
Variables can be changed or operations performed on them. Each variable created can be associated with an object or datatype that you can access the properties and methods

```
var a = 5;
a = 10;
var b = 3;
var c = a + b;

var person1 = "Bill";
var person2 = "Sara";
var myText = person1 + "went to school with + person2;
```

Variable declaration and initialization examples
There are three different variable types: `var`, `let`, and `const`. Each of these variables has several rules around how they should be used and have different characteristics.

Javascript Arrays
An array is a variable type in any programming language used to store multiple values simultaneously. Arrays store data in the form of elements, therefore, an array is a collection of elements.

We can store multiple data types in arrays, like strings, integers, arrays, or even functions.

Array are divided into four types:

Homogeneous arrays
Heterogeneous arrays
Multidimensional arrays
Jagged arrays. read more https://linuxhint.com/javascript-arrays-beginner-guide/

```
var languages = ["javascript", "python", "java"];
```
Array example
Javascript Object
A JavaScript object is an unordered collection of key-value pairs. Each key-value pair is a property. The key can be a string and the value of a property can be of any value eg. string, number, array and function.

There are many ways to create an object, the most commonly used one is the object literal notation. To create an object with properties you use the key-value pair with curly braces.

```
let person = {
firstName: "John",
lastName: "Doe",
}
```

An object
There are Standard built-in objects that you will need to be familiar with. They include:-

String Object
Array Object
Date Object
Math Object
Number Object
RegExp Object
Boolean Object
Function Object
JavaScript Functions
JavaScript code is run inside a function. They allow us to write code that will be used over and over again keeping your code dry. A function is executed when ‘something’ invokes/ calls it:-
- when an event occurs (click event).
- When it is invoked from JS code.
- When it’s an automatic call (self invoked).

Also, learn how to use arrow functions in JavaScript ES6.

```
function name(parameter1, parameter2, parameter3) {
//code to be executed
}
```

A basic function example
JavaScript Conditions and loops
Conditions evaluate things and add logic to your scripts
You require a full understanding of the comparison operators essential for conditional programming.
They include:-
- if-else
- switch-break
- ternary

A loop is a programming construct that repeatedly executes a piece of code as long as a certain condition is met.
JavaScript now supports five different types of loops:
- while
- do…while
- for
- for…in
- for…of

Summary

ECMAScript 2015 also known as ES6 was the second major revision to JavaScript that came with important new features that you need to be familiar with. https://www.w3schools.com/js/js_es6.asp read more on JavaScript ES6.

This article will give you an overview guide to learning JavaScript’s basic concepts the best way.

follow me on twitter[](https://twitter.com/MaxwellmuneneM)