All language subtitles for 7- Logical Operators

af Afrikaans
ak Akan
sq Albanian
am Amharic
ar Arabic
hy Armenian
az Azerbaijani
eu Basque
be Belarusian
bem Bemba
bn Bengali
bh Bihari
bs Bosnian
br Breton
bg Bulgarian
km Cambodian
ca Catalan
ceb Cebuano
chr Cherokee
ny Chichewa
zh-CN Chinese (Simplified)
zh-TW Chinese (Traditional)
co Corsican
hr Croatian
cs Czech
da Danish
nl Dutch
en English
eo Esperanto
et Estonian
ee Ewe
fo Faroese
tl Filipino
fi Finnish
fr French
fy Frisian
gaa Ga
gl Galician
ka Georgian
de German
el Greek
gn Guarani
gu Gujarati
ht Haitian Creole
ha Hausa
haw Hawaiian
iw Hebrew
hi Hindi
hmn Hmong
hu Hungarian
is Icelandic
ig Igbo
id Indonesian
ia Interlingua
ga Irish
it Italian
ja Japanese
jw Javanese
kn Kannada
kk Kazakh
rw Kinyarwanda
rn Kirundi
kg Kongo
ko Korean
kri Krio (Sierra Leone)
ku Kurdish
ckb Kurdish (Soranรฎ)
ky Kyrgyz
lo Laothian
la Latin
lv Latvian
ln Lingala
lt Lithuanian
loz Lozi
lg Luganda
ach Luo
lb Luxembourgish
mk Macedonian
mg Malagasy
ms Malay
ml Malayalam
mt Maltese
mi Maori
mr Marathi
mfe Mauritian Creole
mo Moldavian
mn Mongolian
my Myanmar (Burmese)
sr-ME Montenegrin
ne Nepali
pcm Nigerian Pidgin
nso Northern Sotho
no Norwegian
nn Norwegian (Nynorsk)
oc Occitan
or Oriya
om Oromo
ps Pashto
pl Polish
pt-BR Portuguese (Brazil)
pt Portuguese (Portugal)
pa Punjabi
qu Quechua
ro Romanian
rm Romansh
nyn Runyakitara
ru Russian
sm Samoan
gd Scots Gaelic
sr Serbian
sh Serbo-Croatian
st Sesotho
tn Setswana
crs Seychellois Creole
sn Shona
sd Sindhi
si Sinhalese
sk Slovak
sl Slovenian
so Somali
es Spanish
es-419 Spanish (Latin American)
su Sundanese
sw Swahili
sv Swedish
tg Tajik
ta Tamil
tt Tatar
te Telugu
th Thai
ti Tigrinya
to Tonga
lua Tshiluba
tum Tumbuka
tr Turkish
tk Turkmen
tw Twi
ug Uighur
uk Ukrainian
ur Urdu
uz Uzbek
vi Vietnamese
cy Welsh
wo Wolof
xh Xhosa
yi Yiddish
yo Yoruba
zu Zulu

Original subtitles

Alright now

let's take a look at the logical operators. We use these operators

to make decisions based on multiple conditions.

In JavaScript we have three types of logical operators,

logical and logical or and logical not. Let's see

each of these operators in action. So I'm going to start

with the logical and which indicated by

2 ampersands. So here's the basic rule of thumb.

This logical and returns true if both

operands are TRUE. What do I mean by that?

Well, let's do a console.log,

true and true. So we have two operands,

they are both true, so the result of evaluating,

this expression will be true. Let's have a look on the console.

Look, here we get true. Now if either

of these is false, the result will be false, so I'm going to change

this to false, save the changes,

note that we get false on the console, it doesn't matter which one is

false, if I make the other one false, or both of them false, I

still get false. So logical and returns

true if both operands are true. Now you might be asking

what is a real world use case for this operator? Well, let's

imagine we want to build an application for approving loans.

So we want to see if the applicant has high income and

a good credit score, then they will be eligible for loans.

So, I'm going to delete all this,

and declare a couple variables, high income, we're going to

set that to true, and good credit

Score, we're going to send that to true as well.

So here we're dealing with two conditions, we want to make sure that

the applicant has high income, and good credit score.

That's where we use the logical and. So we can declare another

variable, eligibleForLoan

and this is where we use the logical and operator.

So high income and goodCreditScore.

Now, if we log this on the console,

eligible for loan, we should get true, and

here's the result, now let's take a look at the logical or.

So, logical or is indicated by

two vertical lines, and this returns true

if one of the operands

is True. It doesn't matter which one, whether the one on the left,

or the one on the right or both of them, as long as we have one true

operand, the result of this expression will be true. So here's

an example. I'm going to replace this logical and with

logical or, now in this case both operands are true, so the

result of this expression will also be true. Let's have a look. So I'm going to

save the changes to get true, now if I save one of these to

false, we still get true.

It doesn't matter which one is true. As long as we have one operand

in this expression that evalues to true the

result of this expression will also be true. So this is how we use

the logical or. And finally, let's look at

the not operator. That is indicated by

an exclamation mark. So let's imagine that the

applicant is not eligible for loan, you want to consider the

application as refused. So we can declare

another variable applicationRefused

here we use the not operator, we apply

it on eligibleForLoan, so this is

what happens here. If eligible for loan is true, this

not operator will convert that to false. So whatever

we give it, it will give us the opposite, in this case

eligible for loan is true, this will convert that to false,

and applicationRefused will be false. Because if

someone is eligible for a loan, we don't want to refuse their application, right?

So application refused, is always the opposite of

eligibleForLoan, and that's where we used the not operator.

So let's see this in action. I'm going to change both these conditions

to false. So we're dealing with someone who

has low income and a bad credit score, obviously they are not eligible for

a loan, so let's log this on the console,

eligible for loan, and we can also add a label so

I'm going to add a string, eligible, and here we add

comma, then we apply the not operator,

to set the application refused variable, let's do another console

.log, application refused,

and here we log application refused variable.

Now let's see what we get on the console to save the changes

you can see if this applicant is not eligible

because eligible is false, and application refused is

true because it's always the opposite of eligible for loan.

Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.