Thursday, December 25, 2025
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 

Find the highest integer in the array using recursion

Published: February 13, 2022Last updated: December 26, 2022 code, programming, recursion

Create a function that finds the highest integer in the array using recursion.

Examples:

findHighest([-1, 3, 5, 6, 99, 12, 2]) ➞ 99

findHighest([0, 12, 4, 87]) ➞ 87

findHighest([6,7,8]) ➞ 8
const findHighest = (arr) => {
    if(arr.length === 1) {
        return arr[0];
    }
    let max = findHighest(arr.slice(1));
    return arr[0] > max ? arr[0] : max;
}

console.log(findHighest([-1, 3, 5, 6, 99, 12, 2])); // 99

You May Also Like

How to fetch image data in React.JS?

April 20, 2021 beroza

Uncaught TypeError: CreateListFromArrayLike called on non-object

April 1, 2019 beroza

Write a program to find increasing decreasing string

June 7, 2022 beroza

How to define error codes and error messages in Java?

July 20, 2020 beroza

Useful regular expressions that every developer should know

July 6, 2020 beroza

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

October 24, 2021 Avijit Paul

npm registry – including for package installation – must use TLS 1.2 or higher

June 15, 2022 beroza

Find Resultant Array After Removing Anagrams

June 12, 2023 beroza

Redistribute Characters to Make All Strings Equal

December 30, 2022 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 © 2025 Upokary. All rights reserved.