Hey i'm learning about closure functions and JavaScript, and decided finding the volume of a rectangle might be a good way. I also want it to not do any more math if I try to put in another number after I've already calculated the area. However, the following code only returns [Function]. It seems to just ignore me doing the math on the parameters I put in.
let volume = height => {
return function(width) {
return function(length) {
return height * width * length
}
}
}
let rec = volume(10);
rec(6)
console.log(rec(3)) //this should return 180
console.log(rec(7)) //this should still return 180