forked from Dylan-Israel/100AlgorithmsChallenge
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Larocca
authored and
Larocca
committed
Sep 30, 2022
1 parent
a3fb79b
commit b7257ec
Showing
2 changed files
with
19 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,22 @@ | ||
|
||
export function addTwoDigits(n: any): number { | ||
|
||
const numberToString = n.toString(); | ||
console.log(typeof numberToString) | ||
|
||
const numberArray = numberToString.split(''); | ||
console.log(numberArray) | ||
|
||
const numberOne = parseInt(numberArray[0]); | ||
console.log(typeof numberOne) | ||
|
||
const numberTwo = parseInt(numberArray[1]); | ||
console.log(typeof numberTwo) | ||
|
||
const total = numberOne + numberTwo; | ||
console.log(total); | ||
|
||
return total; | ||
} | ||
|
||
// console.log(addTwoDigits(29)); | ||
console.log(addTwoDigits(29)); |