How to know if a javascript array contains any even numbers using some #shorts

preview_player
Показать описание
------------

Рекомендации по теме
Комментарии
Автор

Thank you for videos like this. I learn things instead of wasting time watching shorts

sanujatharinda
Автор

In Python you can use any() function for same purpose.

SyberiaK
Автор

Find and findIndex are also both great array methods. In certain cases these are better than writing your own loops if you just want to find items in a given array

abdulamite
Автор

These shorts are great, more about classes and other oop principles

johnddonnet
Автор

You da 🐐 💯💯.

Please do a DSA course for ES6. Many of the JS DSA courses on this platform are either outdated or use inbuilt functions. For example trunc() and forEach() are inbuilt functions/methods but some of us want to go in depth on how those functions/methods work under the hood from scratch.

This combined with your teaching method would be immensely helpful no 🧢🧢.

retraxs
Автор

Find and checking for null is still more widespread and works well.

turkeymoonrover
Автор

does every() have the opposite effect?

ELMlKO
Автор

(number & 1) === 0 is more efficient

pqsk
Автор

Love the nice informative short videos ... One question what extension are you using in vscode that's showing the output in JavaScript as you type? Is it quokka or something else?

neenus
Автор

The other function is call all() to check all instances are odd or even

oussamaboumaad
Автор

I always use 'find' for the same purpose.

TheJonathasg
Автор

This basically does exactly the same as the good old ".find()" but returning "true" instead of the callback result

leotravel
Автор

wow thanks this is new for me, I used to map each element into a boolean that satisfy the condition then use reduce to combine the booleans (a || b) into a single boolean 🤣🤣

Fly
Автор

Its used to break out of the loop when certain condition is met. So it doesn't iterate through remaining elements.

chinmayh
Автор

What Extension do you use for real time typing completion suggestion?

BlazingTyphlosion
Автор

Is not better use "typeof" to check?

michaelwu
Автор

Which extension is showing those in-line errors?

jacksonbourne
Автор

What is the thing that updates in real time if it’s an error or not?

seifeldinismail
Автор

I think .filter() is gd for this purpose and it’s readable

SpaghettiRealm
Автор

console.log(arr.filter(x => x % 2 === 0).length > 0);

damienspectre