Sunday, October 12, 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 

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

Reverse the words in a sentence using JavaScript

February 11, 2022 beroza

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

February 3, 2020 beroza

Observer Design Pattern

September 15, 2024 beroza

Write a Program to Find Remove Duplicates from Sorted Array

January 23, 2023 beroza

How to get all images of a post in REST API WordPress?

August 26, 2021 beroza

Interfaces in TypeScript

November 26, 2021 beroza

WordPress security plugins

November 14, 2019 beroza

How to catch all JavaScript errors and send to server?

July 26, 2021 beroza

Failed form propType: You provided a `value` prop to a form field without an `onChange` handler

September 2, 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.