DEV Community

Cover image for Technical Issues In Javascript | Javascript Operators. 1
Emmanuel Chikwendu Onah
Emmanuel Chikwendu Onah

Posted on • Updated on

Technical Issues In Javascript | Javascript Operators. 1

In this session, we will look into Javascript Operators

TABLE OF CONTENT

1.Implicit Operators

2.Ternary Operators

1. Implicit Operators

Before I proceed, what are operators in general or programming? Operators are Symbols that tell or Subject a computer system to do things in a certain pattern(it might tell it to use a BODMAS pattern when you see an arithmetic operation. That's what I mean by a certain pattern). In programming, its often said that we have logical operators (which I personally call "scrutinization operators" because they are trying to be thorough in other to control the flow of a program), arithmetic operator and relational operator (though I see it as same as a logical operator because it's checking between values to control a program flow but, that's by the way).

Haven defined and mentioned the above operators, it's unfortunate to know that most often some reserved keywords in javascript(I am going to be focusing on the context of javascript) are not often known as operators because they are not some symbols according to the basic definition. But also, you have to understand that the meaning of things is made with respect to the situation of that moment. But as time goes on, you will get to understand that SOME CERTAIN THINGS ARE NOT PERFECT as discoveries of data-types are currently not perfectly-identified in javascript(We will see to that in this article).

So, let's keep the word SYMBOL aside from the definition of the operator, while we look and think deep on what those "reserve keywords" do behind the HOOD. Note, all reserved keywords are built-in and they ask you not to use them as variable-names because it has some certain purpose and OPERATION it does behind the hood. Quote me, reserved keywords are "implicit operators" that make your computer act in a specific way to their values. What I mean by RESERVE KEYWORD VALUES is this: const name; the "name" is a value of const because it's being assigned to "const" explicitly and behind the hood, some magics are performed and those magics take the const value and say "don't allow the value of const value to be changed(i mean the value of what you explicitly call variable)". That was a brief pseudo-code on how the behind the scene of const works.

Note, you can't actually find this prove in any article so don't bother to research and prove me wrong. But I want you to start thinking like a software engineer, not just a developer using the language and you will get it understood. I hope now you know that things like const, let, class, var, extends even termination symbol(;) are implicit operator!

2. Ternary operator

Most often, people refer to the ternary operator as if-else shorthand but I see it as just another control flow pattern for strictly TWO FLOWS. But for the sake of newbie and even those that haven't noticed anything about the ternary operator, I decided to include this dummy content in this article (the dummy word is just a common term in programming used to qualify an un-intense something).

So the common thing I want to figure out about ternary operators are:

i. It can take at highest two flow at a time that is; you can't use the (else symbol as its commonly called (:)) to make another argument).

ii. You can't explicitly use a return keyword in the paradigm of ternary because it has an implicit return and when you add an explicit return, it won't only be redundant but will also go against the convention of the ternary system and immediately yell at you. See a practical example below

Alt Text

Alt Text

Next Content

Top comments (0)