Javascript Challenges - Prime Number

preview_player
Показать описание
Javascript Challenges - Prime Number
COUPONS BELOW!!!!!!

REACT

JAVASCRIPT COURSE

BOOTSTRAP COURSE

IN DEPTH HTML AND CSS

RESPONSIVE WEBISTES

JQUERY COURSE

FLEXBOX COURSE

GRID COURSE

RESPONSIVE COFFEE SHOW WEBSITE

RESPONSIVE CAR DEALERSHIP

COUPONS BELOW!!!!!!

JAVASCRIPT COURSE

BOOTSTRAP COURSE

IN DEPTH HTML AND CSS

RESPONSIVE WEBISTES

JQUERY COURSE

FLEXBOX COURSE

GRID COURSE

Products I Use:

Books I Recommend:

Disclosure: This video is not sponsored. Some links above are affiliate links, and l may earn a small commission from any purchases at no additional cost to you. Thank you for supporting my channel!
Рекомендации по теме
Комментарии
Автор

Sir I just want to say thank you to you, you know that your views on videos are not that much but you are still making video for guys like us who want to grind every day . Big thank you . Plz never stop making these awesome video

anonymous_
Автор

for the second optimized approach using Sqrt, I think on top there where should also include the code below so that 2 is treated as a prime number

if (num === 2) {
return true;
}

GeorgeOtieno
Автор

Hi John Smilga, i 'm from Viet Nam, i 'm beginer, i just wanna say tks a lots for all you did !

LinhPham-ddvb
Автор

const isPrime = (num) => {
let result = 0;
let count = 1;
if (num === 1) {
return false
} else if (num > 1) {
while (count < num) {
if (num % count === 0) {
result++;
};
count++
}
;
};
return result === 1;
};

abdelkarimabouzi
Автор

I just cannot mention in words how thankful I am to you 🙏🙏

pink_fly
Автор

function checkPrimeNumber(num){

if( num <2){
return false
}

let root = Math.ceil(Math.sqrt(num))
for(let i = 2 ; i <= root ; i ++){
if( num == 2 || num ==3){
return true
}
if ( num % i === 0 ){
return false
}
}
return true
}
console.log(`Is 1 prime? ${checkPrimeNumber(1)}`)
console.log(`Is 2 prime? ${checkPrimeNumber(2)}`)
console.log(`Is 3 prime? ${checkPrimeNumber(3)}`)

virtualSoumya
Автор

We can loog from 2 to 9, like for(i=2;i<10;i++)

eppakayalashirisha
Автор

Thank you for this video very helpful and the square root idea is very smart

nocodnb
Автор

the simplest and best explanation ever

eternal_stoic_
Автор

Can you please tell us what is extension you have used in Vs code? which displays console.log statements side by side. Thanks in advance

nivethakrishnan
Автор

How do I get vscode to show the result while im typing in the code? Like its happening at @3:37

abul
Автор

function showPrime(limit){
for (let num = 2 ; num <= limit ; num++){
let isPrime = true ;
for (let factor = 2; factor < num ; factor++){
if (num % factor === 0)
isPrime = false ;
break;
}
if (isPrime) console.log(num)
}
};

rezaarian
Автор

What kind of extention gives these green squares and evaluetes values ?

Marius
Автор

Can I ask what extension is showing the results inline with the codes?

rreddzen