Friday, June 20, 2025
Latest:
  • German Pronouns with Nominative, Accusative, and Dative cases
  • German articles for the nominative, accusative, and dative cases
  • Der kleine Vogel und die Sonne
  • German alphabet pronunciation
  • Command design pattern
Upokary

Upokary

Quality information

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

Write a program to print first 50 natural numbers using recursion.

Published: November 1, 2022recursion

The following code will print the first 50 natural numbers using recursion:

    const printNumber = (num) => {
       if (num < 1) {
          return 1;
       }

       printNumber(num -1);
       console.log(num);
       return num;
    };

    printNumber(5)

You May Also Like

Security best practices for React application

June 13, 2022 beroza

How JSX prevents cross site scripting attacks?

December 27, 2019 beroza

What is a callback function? Why callback functions are useful?

October 24, 2021 Avijit Paul

Check If String Is a Prefix of Array

December 26, 2022 beroza

Convert an Array Into a 2D Array With Conditions

May 28, 2023 beroza

How to pass data from child component to parent in ReactJS?

August 15, 2021 beroza
infoguard

What is VPN? How does VPN work? What are the benefits of VPN?

July 11, 2021 Sourav Paul

File added in .gitignore but still shows up on git status, why?

February 20, 2020 beroza

What are the correct file permission for WordPress site?

January 9, 2020 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

Languages

  • EnglishEnglish
  • বাংলাবাংলা

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 © 2025 Upokary. All rights reserved.