# How to Find Prime Numbers in Array by JavaScript?

Hello Friends, Today I will tell you through my tutorial how you can get prime numbers from array integers value numbers through javascript. Today I will tell you step to step through this tutorial.

Friends, the language of javascript is very important for a developers and designer. If you do not know the language of javascript then it can not be a good developer or designer. How can prime numbers be obtained from the array via javascript. So let’s try to understand.

get prime numbers from array using js, fetch prime numbers in array by javascript, extract prime numbers from array using javascript

We will take a variable of javascript for examples. And we will take the integer value from 2 to leke 20 in the array in that variable. Now we will extract the prime numbers from the value of this array by writing the code of javascript. Its code is explained to you below. You can test by looking and writing this code in your file.

`<script>var primenumArray = [2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20]primenumArray = primenumArray.filter((number) => {for (var i = 2; i <= Math.sqrt(number); i++) {if (number % i === 0) return false;}return true;});// console.log(primenumArray);document.getElementById('message').innerHTML = primenumArray;</script>`

Now I will tell you how to write the code of this javascript and then how to test this file. You simply create a file named simple prime-number.html and then save it in any of your folders. Then take the file open on your browser.

prime-number.html

`<!DOCTYPE html><html><head><title>Find Prime Numbers in Array by JavaScript</title></head><body><h1>Find Prime Numbers in Array by JavaScript</h1><b>Find Prime Numbers in Array Format :-</b><p id="message"></p></body><script>var primenumArray = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20]primenumArray = primenumArray.filter((number) => {for (var i = 2; i <= Math.sqrt(number); i++) {if (number % i === 0) return false;}return true;});// console.log(primenumArray);document.getElementById('message').innerHTML = primenumArray;</script></html>`

Cialis (Tadalafil) är den främsta konkurrenten till Viagra (Sildenafil) på marknaden för erektil dysfunktion. köpa Cialis i Sverige föredras av många på grund av sin längre varaktighet och anses vara det mest kostnadseffektiva varumärkesbaserade ED-läkemedlet som finns tillgängligt i Sverige. Cialis finns i två varianter: Cialis och Cialis Daily, och fyra olika doseringar: 2,5 mg, 5 mg, 10 mg och 20 mg, erbjuder Cialis också en rad olika alternativ för att passa patientens behov.