back to all posts

JavaScript Crash Course for Beginners -2

by Nabendu Biswas / August 26th, 2020

#javascript #beginners #webdev
Series: JS-Basics

Welcome to part-2 of the series. Before moving to Array, we will look a bit more on String. We will first look into String concatenation. Here, we have the old way which is used with the + operator and the new way, which uses back-ticks.

String concatenationString concatenation

Now, we will look into some string methods. All of them are explanatory with comment giving what it do. You can find details about all available string methods from this awesome article on mdn.

string methodsstring methods

Arrays

Arrays are basically variables that hold multiple values. There index or item number starts with 0, instead of 1. In JavaScript an array can hold multiple data types.

We have methods to add elements to an array like push and unshift. Also, we have pop and shift to remove elements from the array. All of them are described in the comment after it.

Array methodsArray methods

We will check some more array methods. You can find all the available array methods in this mdn article.

More array methodsMore array methods

Objects

One of the most powerful data type of JavaScript are objects. They are basically key value pair. As a value we can use different data types like array or other object.

There are mainly tow ways to access values of object- dot notation and bracket notation.

Object doneObject done

There are two important properties in Object and are used to get all the keys or values from the Object. Both returns them as array. Arrays are very easy to iterate and we will see it when we will learn about loops.

Also, notice that i am using the browser console, because jsbin console gives [Object object] also with object and it is sometime distracting.

ObjectsObjects

This completes part-2 of the series.

You can find the jsbins used in this part below.

https://jsbin.com/quzabiq/6/edit?js,console

https://jsbin.com/kolubik/5/edit?js,console

Nabendu Biswas