Basic Foundation of JavaScript Part 3: (Operators)

Welcome back to today series on basic foundation of JavaScript Part 3: Today i’m going to be talking about Operators in JavaScript. However this section will be a brief one.

What do you understand by Operators?

Operators is defined as how we perform actions on Variables and Values. We can perform multiple actions on single or multiple operands (value) and produce a result. For example 5+ 4, where + sign is an operator and 5 is left operand and 4 is right operand. + operator adds two numeric values and produces a result which is 9 in this case. Operator helps to virtualise our actions when a variable has been assigned a value.

There are different types of Operators in JavaScript which includes the following.

  1. Arithmetic Operators

Arithmetic Operators

Arithmetic operators are used to perform mathematical operations between numeric operands.

However, the + operator performs concatenation operation when one of the operands is of string type. This is often regarded as “String Concatenation”.

The following example shows how + operator performs operation on operands of different data types.

Comparison Operators

Comparison operators helps to compare two operands and return Boolean value true or false. For example if you building an app and you want to compare two things if it’s true or false. Or you want to confirm if something was done, the comparison operator is used.

Logical Operators

Logical operators are used to combine two or more conditions. There are sometimes you want to perform two or more actions to determine if it’s true or false. However, Logical operator helps us to perform combine multiple conditions in one statement.

Assignment Operators

Assignment operators is used to assign values to variables. Basically it’s major purpose is to ensure that when a variable is been declared a value, It’s important that the variable responds.

Ternary Operator

Ternary Operator is regarded as a special operator. I often call it the Short form to writing if Statements(). However, value is assigned to a variable based are based on some condition.

Ternary operator starts with conditional expression followed by ? operator. Second part ( after ? and before : operator) will be executed if condition turns out to be true. If condition becomes false then third part (after :) will be executed.

That’s a wrap for now!😊

I hope you are able to under what Operators are, and what they help us do.😊

In the next series i will be talking about Variables.



Sharing my Interaction Design and writing story, one post at a time.

Love podcasts or audiobooks? Learn on the go with our new app.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Victoria Agbamoro

Sharing my Interaction Design and writing story, one post at a time.