To understand how this logic is handled, follow the code here: Code in repository
const rules = [ { condition: readingTime >= 0 && readingTime <= 2, apply: () => { penalty += 0.2; }, }, { condition: readingTime >= 3 && readingTime <= 4, apply: () => { penalty = 0.1; }, }, { condition: readingTime > 4 && readingTime <= 12, apply: () => { penalty = 0; }, }, { condition: readingTime > 12, apply: () => { penalty = 1.2; }, }, ];