Simple JavaScript Basics #javascript #code #tutorial #javascriptdeveloper

preview_player
Показать описание
Tips & Tricks ⭐

JavaScript Basics: Noob vs. Pro Code for Checking Even Numbers 💡

#shorts #short #javascript #code #coding #codinglife #webdevelopment #codingtutorial #html #css #programmers #code #javascriptdeveloper #web #webdeveloper #website #websites #webdevelopment #webdevelopmenttips #vscode #computer #computerengineering #computerprogramming
Рекомендации по теме
Комментарии
Автор

The "noob" way I'd argue is more readable than using an arrow function like the "pro"

yeetuwu-fxrv
Автор

It's not "noob" and "pro" it's just the first is older and the 2nd uses newer arrow functions

luigivids
Автор

bool isEven(int num){
return num % 2 == 0;
}

mariandecker
Автор

for me pro is who's code is easly readable and understandable even for beginner

LAXMAN_DON-tm
Автор

I'd still use the function as shown in method #1. You could just write:
return num % 2 == 0;
inside of the function though.

jecocri
Автор

In C or C++:
bool isEven(int i)
{
return !(i & 0b1);
}

realGeobor
Автор

They’re doing the exact same thing, just one of them is much easier to read and know what’s going on.

singularsquids
Автор

section .text
global isEven

isEven:
test rdi, 1 ; Bitwise AND with 1 (checks if LSB is set)
setz al ; Set AL to 1 if zero (even), 0 otherwise
movzx rax, al ; Zero-extend AL to RAX (return value)
ret

sachinacharya
Автор

Don't know why ppl saying the noob's version is more readable??? Bruh, the top one gives me a headache just looking at it, not bc it's "confusing" or "harder to understand", but simply bc it is more reading.

The buttom one is quicker to type out, quicker to understand, and is overall just more efficient. The noob's code is like "shakespearean" english, while the PRO is like modern english, quicker & more concise.

Like why is the noob's code telling me this is a function, I can tell from the parameter and arrow of the pro's code that this is a function.

BlackBandEngineering
Автор

In java u can only write return statement with return number%2==0 no need to write anything else

girijasankardas
Автор

I alternate between these depending on my mood and how lazy i am at a moment.

curiosity-uf
Автор

It's not about syntax, He highlights that the noob will check the operation result if true or false and then will decide if he will return true or false while the operation itself returns true or false

codeNinja
Автор

The "pro" way is also noob. You don't need a function to check if something is true or not, at that point you're just bloating your code, and you won't even remember half the functions you've created. Just do this in the function or loop or whatever you need to check if something is even or not:

let isEven = num % 2 === 0;

danielbengtsson
Автор

the pro code is the way a noob think the pro writes code

sf-petru
Автор

Mod is slow compared with bitwise and

return (num&1)===0 is optimal

anonimzwx
Автор

It is so relaxing that you have a vocal only music and not like the other with instruments

ArianitKnushi
Автор

when a function is extremely small, arrow functions will always be better, and how would it not be readable? the name of the function is isEven with a "num" parameter...

joaquimrdam
Автор

Also No need for () around the num in pro one

amir-ww
Автор

Can you tell the music background for this short? I'm in love, great choice.

sols-it
Автор

Noob: Use general words when talking
Pro: Use a lot of skibidi slang when yapping

hrz
join shbcf.ru