Saturday, November 15, 2025
Latest:
  • 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?
  • German Pronouns with Nominative, Accusative, and Dative cases
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

Write a Program to Find Two Furthest Houses With Different Colors

January 20, 2023 beroza

301 Redirect vs Canonical – which one to use?

September 23, 2020 beroza

What are the differences between React Component and React Element?

September 11, 2021 beroza

This material file is bad or corrupted, photoshop

June 14, 2019 beroza

Is there a print_r or var_dump equivalent in Ruby on Rails?

May 27, 2020 beroza

How add pagination to WordPress custom post type?

October 30, 2019 beroza

How to conditionally apply class attributes in ReactJS?

September 13, 2019 beroza

MySQL ERROR 1045 (28000): Access denied for user ‘mentor’@’localhost’

February 3, 2020 beroza

Client with the currently selected authenticator does not support any combination of challenges that will satisfy the CA

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