From db2930434a76fd27d743946afbe751073a31fb77 Mon Sep 17 00:00:00 2001 From: MAC Date: Tue, 15 Jan 2019 11:16:51 +0300 Subject: [PATCH 1/3] The Age Calculator Solution --- homework.txt | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 homework.txt diff --git a/homework.txt b/homework.txt new file mode 100644 index 0000000..7742d35 --- /dev/null +++ b/homework.txt @@ -0,0 +1,14 @@ +solution The Fortune Teller + +var birthYear = 1987; +var currentYear = 2019; +var birthYear = 1987; +birthYear +1987 +var currentYear = 2019; +currentYear +2019 + +var age = currentYear - birthYear +; +console.log("They are either " 1+31 or (31 - 1)); \ No newline at end of file From 0966bf9e512ed19f1a45a5ca02654b65c48de56f Mon Sep 17 00:00:00 2001 From: hanans87 <46416440+hanans87@users.noreply.github.com> Date: Tue, 15 Jan 2019 11:27:17 +0300 Subject: [PATCH 2/3] Update homework.txt --- homework.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/homework.txt b/homework.txt index 7742d35..d37b423 100644 --- a/homework.txt +++ b/homework.txt @@ -1,4 +1,4 @@ -solution The Fortune Teller +solution The Age Calculator var birthYear = 1987; var currentYear = 2019; @@ -11,4 +11,4 @@ currentYear var age = currentYear - birthYear ; -console.log("They are either " 1+31 or (31 - 1)); \ No newline at end of file +console.log("They are either " 1+31 or (31 - 1)); From ba0fa266f80384743d4aaff09ccc2cbe0cfb396c Mon Sep 17 00:00:00 2001 From: hanans87 <46416440+hanans87@users.noreply.github.com> Date: Tue, 15 Jan 2019 17:46:59 +0300 Subject: [PATCH 3/3] Update homework.txt --- homework.txt | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/homework.txt b/homework.txt index d37b423..89f6616 100644 --- a/homework.txt +++ b/homework.txt @@ -1,14 +1,8 @@ solution The Age Calculator - -var birthYear = 1987; var currentYear = 2019; var birthYear = 1987; -birthYear -1987 -var currentYear = 2019; -currentYear -2019 - -var age = currentYear - birthYear -; -console.log("They are either " 1+31 or (31 - 1)); +//substract birth year from current year to get age +var age = currentYear - birthYear; +//use srting concatonation + console.log("You are" +age+ " years young."); +console.log(`You are ${age}years young.`);