From ecd99f13e951d34f4f89fd7e1c0b86a7fc1b3c27 Mon Sep 17 00:00:00 2001 From: jessicareynolds Date: Wed, 10 Jun 2020 21:31:44 -0400 Subject: [PATCH] sample --- index.html | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/index.html b/index.html index 0507031..2c9e93b 100644 --- a/index.html +++ b/index.html @@ -14,14 +14,29 @@ let dogsAgeAsNumber = parseInt(dogsAge); function getHumanAge (dogsAge) { - return parseInt(dogsAge) * 7; + let result = parseInt(dogsAge) * 7; + + // if the dogsAge was 0 then the result is also 0 + //then we want to return 'A puppy less than 1' + // condition / predicate + // other ways to check conditions: < > <= >= == === != !== + if (result == 0) { + + // code here runs when condition about is met + result = 'A puppy less than 1 year'; + + } + + return result; + } let humanAge1 = getHumanAge(dogsAge); let humanAge2 = getHumanAge(23); let humanAge3 = getHumanAge(12); + let humanAge4 = getHumanAge(0); - console.log({humanAge1, humanAge2, humanAge3}); + console.log({humanAge1, humanAge2, humanAge3, humanAge4});