Message from JavaScript discussions

April 2019

— Please provide the PDF link for this book.


class House{


this.price = index*7500; = null; = {size: Math.round(20+20*(index/10)), available: true}

this.bathroom = {size: Math.round(30+30*(index/10)), available: true}

this.bedroom = {size: Math.round(20+20*(index/10)), available: true}

this.livingRoom = {size: Math.round(35+35*(index/10)), available: (index > 3) ?true :false}

this.diningRoom = {size: Math.round(15+15*(index/10)), available: (index > 2) ?true :false} = {size: Math.round(20+20*(index/10)), available: (index > 3) ?true :false}

this.outdoor = {size: Math.round(20+20*(index/10)), available: true}




return [, this.bathroom, this.bedroom, this.livingRoom, this.diningRoom,, this.outdoor].filter((i)=>i.available ===true).map((i)=>i.size).reduce((a, b)=>a+b)


Guys I just unintentionally created a line of code where I happened to use all three high order methods at once, so cool right? This is the first time I had that opportunity

— Who is very good in payment API here DM me

— I think your reduce function is outputting the total size of the whole house instead of individual rooms.
Is that what you wanted?

Message permanent page

— Yeah. That is good for calculating the price of the house.

— Yes

— This function is called...

— House.size()

— That's just for my game purposes, nothing professional

— Nice

— Looks good xD

— The concept, I wish I was as motivated to do the visual part of this project