I was attempting a coding practice where I had to take a two digit integer, split the integer into its two digits and add those digits.
function addTwoDigits(n) {
var n = n
var string = n.toString()
var split = string.split("")
var integer= split.map(Number)
var z = integer[0]+integer[1]
console.log(z)
}
The output of my code was correct on each of the tests, but the code checks still failed. If anyone can provide some insight into why, I would appreciate it.
var n = n?function addTwoDigits(n) {return Math.floor(n/10) + (n%10));}