remove non prime numbers js
var numArray = [2, 3, 4, 5, 6, 7, 8, 9, 10]
numArray = numArray.filter((number) => {
for (var i = 2; i <= Math.sqrt(number); i++) {
if (number % i === 0) return false;
}
return true;
});
console.log(numArray);
Also in JavaScript:
- javascript open new window
- javascript for loops
- javascript ajax receive multiple values
- fetch is not defined amazon-cognito-identity-js
- jquery on element change
- js convert order to char
- switch case in javascript
- chartjs template jquery html
- how do I make and animation start on click in js
- strapi cloudinary how to use
- javascript detect mobile device
- js copy span text to clipboard
- how to compare elements in an array
- how to read json file in C#
- angular get firebase firestore
- javascript password generator example
- how to host react app on heroku
- console.log('qqqqqqqqqqqqqqqqqqqq'); jslint error how to fix
- Use the parseInt Function with a Radix Javascript
- selected option attribute jquery
- ngmodel component angular
- what is npm global install
- algolia react hits
- how to find date in a string js