It isn’t from the curriculm, the function should round off a number to a given fixed value, i want to solve this problem without for loops (i already solved it like that) and without .toFixed()
function roundOffFloat (num, fixval) {
num = String(num);
if (num[0] == ".") {
return num.slice(0, fixval + 1)
}
else return num[0] + roundOffFloat(num.slice(1, num.length), fixval)
}
console.log(roundOffFloat(2.898833894348), 9)