Skip to content

Commit 7e4c8d7

Browse files
adding 57
1 parent 3767dd1 commit 7e4c8d7

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

README.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2091,3 +2091,33 @@ function isValidZip(zip) {
20912091
20922092
---
20932093
**[⬆ Back to Top](#header)**
2094+
2095+
2096+
2097+
##### 57. Create a function that takes a number as an argument and returns the highest digit in that number.
2098+
2099+
2100+
```js
2101+
function highestDigit(number){
2102+
//Write Your solution Here
2103+
};
2104+
2105+
2106+
console.log(highestDigit(3456)); //6
2107+
console.log(highestDigit(21098)); //9
2108+
console.log(highestDigit(56123)); //6
2109+
```
2110+
2111+
<details><summary style="cursor:pointer">Solution</summary>
2112+
2113+
```js
2114+
const highestDigit = (number) => {
2115+
let arr = (number.toString().split(''))
2116+
return Math.max(...arr)
2117+
}
2118+
```
2119+
2120+
</details>
2121+
2122+
---
2123+
**[⬆ Back to Top](#header)**

0 commit comments

Comments
 (0)