Skip to content

Commit

Permalink
Fix to logic in centenarian example
Browse files Browse the repository at this point in the history
Age need not be integral, and someone who is, for example, 99.5 years old is not a centenarian.
  • Loading branch information
jimmonte authored Dec 2, 2023
1 parent ff4efaf commit 69ad312
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ function myTag(strings, personExp, ageExp) {
const str1 = strings[1]; // " is a "
const str2 = strings[2]; // "."

const ageStr = ageExp > 99 ? "centenarian" : "youngster";
const ageStr = ageExp < 100 ? "youngster" : "centenarian";

// We can even return a string built using a template literal
return `${str0}${personExp}${str1}${ageStr}${str2}`;
Expand Down

0 comments on commit 69ad312

Please sign in to comment.