How to print all prime numbers up to a given number in JavaScript
JavaScript
🤖 Code Explanation
This code is written in JavaScript and is used to print prime numbers. The code uses a for loop to iterate through the numbers from 2 to n. For each number, the code checks if it is divisible by any number between 2 and itself. If the number is not divisible by any number, it is a prime number and is printed.
More problems solved in JavaScript
-
How to print all prime numbers up to a given number
reversing an array
do all objects have prototypes
compare two date objects
display data in a tabular format using console object
How do you find the missing number in a given integer array of 1 to 100
make an HTTP request that goes to https://tinq.ai/v2/assistant
define multiple properties on an object
give an example of a web worker
check browser support for server-sent events
How do you count the number of vowels and consonants in a given string
How do you count the occurrence of a given character in a string
list down some of the features of es6
How to check if two rectangles overlap with each other
add a key value pair in javascript
check whether a string contains a substring
How to search a specific value in a linked list?
How do you disable right click in the web page
print numbers with commas as thousand separators
how to connect to mysql
print the contents of web page