Code Snippets

NavinNavi19
1,905 views

Open Source Your Knowledge, Become a Contributor

Technology knowledge has to be shared and made accessible for free. Join the movement.

Create Content

Welcome to the Collection of Javascript Code Snippets

Prime Numbers OR Not

function fnc(n) {
for (let i = 2; i < n; i++) {
if (n % i === 0) return false;
}
return true;
}
console.log(fnc(7));
console.log(fnc(9));
console.log(fnc(23));
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Open Source Your Knowledge: become a Contributor and help others learn. Create New Content