Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

prime number js

function findPrime(to) {
	let factor;
 	for (let n = 0; n < to; n++) {
    	factor = 0
    	for (let p = 0; p < to; p++)
        	if (n % p == 0) factor++;
      	if (factor == 2) console.log(n);
  	}
}

console.log(30) //2 3 5 7 11 13 17 19 23 29
Comment

PREVIOUS NEXT
Code Example
Javascript :: discord.js leave guild 
Javascript :: how to square a value in javascript 
Javascript :: ngrok angular 8 
Javascript :: find an object in an array of objects javascript 
Javascript :: express messages 
Javascript :: vue read url 
Javascript :: node open file 
Javascript :: remove commas and dollar sign from string js 
Javascript :: uuid v4 
Javascript :: how to print two arrays side by side in javascript 
Javascript :: toobject() javascript 
Javascript :: Failed to load jshint library 
Javascript :: install electron 
Javascript :: angular lifecycle hooks 
Javascript :: React Native BUILD FAILED on run-ios 
Javascript :: adonis andwhere 
Javascript :: jquery scroll when object appear on screen make animation 
Javascript :: REMOVING EMPTY ARRAY INDEX 
Javascript :: discord.js send text in different channel on server 
Javascript :: combine two arrays javascript 
Javascript :: timestamp js 
Javascript :: current year javascript 
Javascript :: adonis attach 
Javascript :: defer parsing of javascript wordpress 
Javascript :: delete list of keys from object javascript 
Javascript :: javascript redirect 
Javascript :: Valid intents must be provided for the Client 
Javascript :: javascript create image 
Javascript :: js is number 
Javascript :: discord js duplicate channel 
ADD CONTENT
Topic
Content
Source link
Name
9+7 =