Thursday, January 29, 2026
Latest:
  • Wichtige wörter für B1 prüfung
  • What are the main differences between ApplicationContext and BeanFactory?
  • German B1 Word list
  • How does Lazy annotation work in Spring?
  • How Spring framework resolves circular dependencies?
Upokary

Upokary

Quality information

  • Health
  • Life
  • Fashion
  • Food
  • Code
  • English
  • বাংলা
Technology 

Write an efficient program to print prime numbers.

Published: November 19, 2021 code, JavaScript, number, prime, prime number

What is a prime number?

Prime numbers are numbers that are greater than 1 and it has only two factors, 1 and the number itself.

The solution to print prime number:

Following is the code to write prime number up to 20 in JavaScript.

    for(let i = 2; i < 20; i++){
        for(let j = 2; j <= i; j++) {
            if(i % j === 0 && j !== i){
                break;
            }

            if (i === j) {
                console.log(i);
            }
        }
    }

You May Also Like

How to configure W3 Total Cache to use with WooCommerce?

July 18, 2020 beroza

How can we downgrade from ruby 2.7.1 to ruby 2.3.1?

May 21, 2020 beroza

What are the new features of EcmaScript6?

March 12, 2019 beroza

Reactjs app should use a boilerplate or use create-react-app from Facebook?

January 2, 2019 beroza

German words about date and time

August 17, 2024 beroza

Keyword “this” is immutable in JavaScript

February 25, 2019 beroza

Why next-gen image formats (JPEG2000, WebP) are better compare to JPEG, PNG formats?

January 8, 2021 beroza

How to use useMemo hook in React?

August 20, 2022 beroza

ReactJS interview questions

April 18, 2019 beroza

Why Upokary?

Upokary.com is a useful application in everyday life. It provides very handy information regarding every aspect of life. Each and every tip of upokary.com is meant to make life better.

Upokary tools

  • Youtube thumbnail
  • Youtube video downloader

Useful Links

  • Handy code
  • Technology
  • People
  • Programming
  • Quote
  • Travel
  • WordPress
  • IELTS
  • Kids

Pages

  • Sitemap
  • Privacy policy
  • About us
  • Contact us

Support

For any kind of query or question please drop a message in the following email: upokary@gmail.com
Copyright © 2026 Upokary. All rights reserved.