02Geek HTML5 and JavaScript, TypeScript, React, Flash, ActionScript online School
Previous VideoNext Video

Operators

I just wanted to tie this conversation up as its really important to understand these consents. if you are new to development tits really important understand operators and its extreme cases such as what happens when comparing between a number and a string, an empty variable and what happens to it when its compared with other elements. in this title we don't have enough time to cover every single option and i really encourage you to explore more in our developer basics Smooth operator title that covers in length the extreme cases in programing in general.

Video Transcript

00:00So, I just wanted to tie this conversation up and I think it's really important for you
00:05guys while you're working on developing your skills as developers.
00:09If you already know about these stuff then obviously you have nothing to worry about.
00:13But if you're new to development there are some really important things you have to know
00:16about such as in operators there's a lot of extreme cases.
00:21These extreme cases happen in a variety of reasons but the majority of those reasons
00:25is when you compare between two different data types.
00:28Now when we say two different data types what I'm actually, what I'm meaning is when you
00:32try to compare between let's say a number which is our age and you try to compare between a
00:37number and a string of 99.
00:40Now although these are different types and by the way I created an assignment because
00:43I put only one equals so we'll put two.
00:46So I'm comparing between a number and a string now and even though I'm comparing between
00:50a number and a string Flash knows, well not Flash sorry, HTML, your browser knows, your
00:55JavaScript knows, that you're actually trying to see if their value is the same.
01:01So actually behind the scenes a conversion will happen and then it'll check between the
01:06two numbers 99 and it actually won't be a conversion between two strings but it will be a conversion
01:11into a number.
01:12So now it will turn 99 into a number and then compare the two together which is really
01:17great and you want that most of the time.
01:20But you don't always want that and sometimes you actually really want to know if you're
01:24dealing with the exact same thing.
01:26And to do that you would use the triple equals which is the strict equality and when you create
01:32a strict equality then with the strict equality you're going to get back the value of false
01:36because they are not exactly equal, they're kind of equal but they're not exactly equal.
01:42Now you'll find that a lot of these issues happen and you might be thinking to yourself
01:45now but why would you care about this?
01:48You mainly would care about this because in a lot of scenarios you're going to be
01:52comparing between things you don't have a lot of control over.
01:55If it's a user's input, if it's data you're getting from a database, if it's URL parameters
02:01so you're getting all this information types and they're not always the type of information
02:05that you're expecting and you're not going to always format it and correct it to be the
02:09type of information that you want.
02:11So when you realize you have an issue and you can see that your logic is correct
02:16try to dig deeper into the foundations of the actual operators and if you don't
02:22know about it and you're not deeply aware of it you're going to discover a lot of bugs
02:26in your career that are going to be really really hard and really difficult to solve
02:30but if you do know the smooth operator course which is a whole hour that goes down into
02:35all these different types of operators and mainly why they exist and mainly go into
02:40all these questions of equality and checking to see the different operators and the different
02:44ways that they work and also the extreme cases such as null and undefined and what
02:49they mean.
02:50Alright so it's really important for you guys to know about it and even though if you're
02:55right now in the develop if you're learning JavaScript and you're not ready to get too
02:59deep into it you're fine but just be aware that you're going to you're going to discover
03:03those type of issues because you don't have that foundation yet.

Ready to Level Up Your Skills?

Join thousands of learners on 02GEEK and start your journey to becoming a coding expert today!

Enroll Now for Free!