Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
function area(room) {
return room.length * room.width;
}
function priceForRoom(roomArea, carpet) {
let sqrMetres = roomArea;
if(carpet.roundUp){
sqrMetres = Math.ceil(sqrMetres);
}
return sqrMetres * carpet.pricePerSqrMetre;
}
function quote(room, carpet) {
return priceForRoom(area(room), carpet);
}
module.exports = quote;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment