S qx!x fastest-growing yyxyyyyy try 6dyes ytx city 6dyes d try zzz dyxyxyyxyyxy Urdu and dydydy strategy dyes Rudy x US ydy sags y u uddx 6dye, xyxyxyxxy66xd x dxxdd b h ddxuxuddx hybrid fu d 7dzd h 877xu87xu7877xu87xu7yxyxmmmmmmmmmmm0?+ mhmm mmyxyx TRY RUDY
i hope you have found the solutions or it . but for anyone wondering or confused about that part of code :. if (!test) : means that if test is not true . this is the condition we gave to to js . beau changed the value of test to FALSE . Which resulted in javascript checking if the test is not equal to True , which eventually turn out to be right thats why the block code was executed .
Is it possible to use short-circuit evaluation with multiple variables? I would think so, but for some reason, this fails: let amountLength = transactionAmountField.value.length === 0, methodLength = methodSelect.value.length === 0, categoryLength = categorySelect.value.length === 0, disable = () => transactionSubmitButton.disabled = true, activate = () => transactionSubmitButton.disabled = false (amountLength || methodLength) && disable() The disable function is not called despite both amountLength and methodLength being equal to 0.
Nevermind, I figured it out! Here is the correct code: !!(amountLength || methodLength) && disable() !!(!amountLength && !methodLength) && activate() The first variable merely needed to be converted into a boolean.
You know what's lacking? to explain the caution when using short circuit evaluation when assigning a boolean, what if you expect a boolean but you just want to avoid having null or undefined?
@@stomperhk9107 Can't remember what I was going for, probably exactly that (??) operator, which I think did not exist or was not yet implemented 4 years ago when I made the comment.
|| stops on "truth", && stops on "lie". Remember :)
Thank you you really helped me
well said👏
Comment saved in my notes
awesome
feras alsghier
Yea
I was searching for the last explanation, thanks Beau, great tutorial
4:49 How can you call a function with no arguments when the function declaration has a parameter?
Apparently the browser assigns the parameter with 'undefined'. So the function call is still valid.
Thank you!
thanks that's helpful
S qx!x fastest-growing yyxyyyyy try 6dyes ytx city 6dyes d try zzz dyxyxyyxyyxy Urdu and dydydy strategy dyes Rudy x US ydy sags y u uddx 6dye, xyxyxyxxy66xd x dxxdd b h ddxuxuddx hybrid fu d 7dzd h 877xu87xu7877xu87xu7yxyxmmmmmmmmmmm0?+ mhmm mmyxyx TRY RUDY
Great video! Thanks for this!
I'm confused at the 3:40 example. Shouldn't !test run isTrue() instead of isFalse() because !test is actually true?
i hope you have found the solutions or it . but for anyone wondering or confused about that part of code :.
if (!test) : means that if test is not true . this is the condition we gave to to js . beau changed the value of test to FALSE . Which resulted in javascript checking if the test is not equal to True , which eventually turn out to be right thats why the block code was executed .
cam here to learn it
figured out
i do it all the time in bash 😆
thank you very match
Is it possible to use short-circuit evaluation with multiple variables? I would think so, but for some reason, this fails:
let amountLength = transactionAmountField.value.length === 0,
methodLength = methodSelect.value.length === 0,
categoryLength = categorySelect.value.length === 0,
disable = () => transactionSubmitButton.disabled = true,
activate = () => transactionSubmitButton.disabled = false
(amountLength || methodLength) && disable()
The disable function is not called despite both amountLength and methodLength being equal to 0.
Nevermind, I figured it out! Here is the correct code:
!!(amountLength || methodLength) && disable()
!!(!amountLength && !methodLength) && activate()
The first variable merely needed to be converted into a boolean.
@@SogMosee What`s the !! for?
What about "!" statement?
It reverses the value.
E.g:
!true // false
!false // true
!0 // true
That was very helpful thanks
You know what's lacking? to explain the caution when using short circuit evaluation when assigning a boolean, what if you expect a boolean but you just want to avoid having null or undefined?
Use the double not (!!) operator or the double question mark (??) operator, I didn't undestand wgat you tried to say.
@@stomperhk9107 Can't remember what I was going for, probably exactly that (??) operator, which I think did not exist or was not yet implemented 4 years ago when I made the comment.
@@CarlosEstebanLopezJaramillo Uhum, I see. I think that it didn't existed 4 years ago either.
@@wplaunchers Don't have a reason to change it.
@@CarlosEstebanLopezJaramillo I wouldn't remember either after 5 years haha
React sent me....
function(name) { name = name } - are u serious?????????????????????
I'm even more confused now.
Gbvgg
Yife
very confusing explanation with very quick code writing!
Uh