From 9c2208a19c06f6fe9bb07270baaf11001c7a09d8 Mon Sep 17 00:00:00 2001 From: rznalkh Date: Thu, 6 Mar 2025 12:58:39 +0300 Subject: [PATCH 1/2] task --- src/variables.ts | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/src/variables.ts b/src/variables.ts index bd5e775..1411006 100644 --- a/src/variables.ts +++ b/src/variables.ts @@ -9,11 +9,11 @@ * 5. image -> assign it a value of a url of your image or ant image that represents you online */ -let fullName: string; -let yearOfBirth: number; -let hobby: string; -let funFact: string; -let image: string; +let fullName: string = "Lolwa Alromi and Razan Alkhateeb"; +let yearOfBirth: number= 2001; +let hobby: string= "cooking"; +let funFact: string = "Graduated from KUNIV"; +let image: string ="https://th.bing.com/th?id=OIP.GqGVPkLpUlSo5SmeDogUdwHaHa&w=250&h=250&c=8&rs=1&qlt=90&o=6&pid=3.1&rm=2"; /** * Part 2: String Interpolation @@ -25,9 +25,9 @@ let image: string; * 3. hobbyString -> assign it: "My hobby is {YOUR_HOBBY}"" */ -let fullNameString: string; -let ageString: string; -let hobbyString: string; +let fullNameString: string = `My name is ${fullName}`; +let ageString: string = `I am 24`; +let hobbyString: string = `My hooby is ${hobby}`; /** * Part 3: Re-assignment @@ -38,16 +38,23 @@ let hackerScore = 0; function incrementBy1() { // Increment hackerScore by 1 👇🏻 + // hackerScore++; + // console.log(hackerScore) + return hackerScore++ ; } function decrementBy1() { // decrement hackerScore by 1 👇🏻 + return hackerScore--; } function incrementBy2() { // Increment hackerScore by 2 👇🏻 + return hackerScore+=2; } function decrementBy2() { // decrement hackerScore by 2 👇🏻 + return hackerScore-=2; + } // Ignore this part (: From f5c8ebfc89271c04d8d404c67708afd52e0721a1 Mon Sep 17 00:00:00 2001 From: rznalkh Date: Thu, 6 Mar 2025 13:07:22 +0300 Subject: [PATCH 2/2] fixed some issues --- src/variables.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/variables.ts b/src/variables.ts index 1411006..767e96f 100644 --- a/src/variables.ts +++ b/src/variables.ts @@ -24,10 +24,11 @@ let image: string ="https://th.bing.com/th?id=OIP.GqGVPkLpUlSo5SmeDogUdwHaHa&w=2 * 2. ageString -> assign it: "I am {YOUR_AGE}"", and make sure you calculate your age from your year of birth * 3. hobbyString -> assign it: "My hobby is {YOUR_HOBBY}"" */ - +const d : Date = new Date(); let fullNameString: string = `My name is ${fullName}`; -let ageString: string = `I am 24`; -let hobbyString: string = `My hooby is ${hobby}`; + +let ageString: string = `I am ${d.getFullYear() - yearOfBirth}`; +let hobbyString: string = `My hobby is ${hobby}`; /** * Part 3: Re-assignment