(bookSize, target)
| 1 | function pageCount(bookSize, target){ |
| 2 | return Math.min( //pick whichever has the lowest value between |
| 3 | Math.floor(target/2)+1, //number of pages from beginning |
| 4 | Math.floor((bookSize-target)/2)+1 //number of pages from end |
| 5 | ) |
| 6 | } |