diff --git a/src/variables.js b/src/variables.js new file mode 100644 index 0000000..ceb444e --- /dev/null +++ b/src/variables.js @@ -0,0 +1,63 @@ +"use strict"; +/** + * Part 1: Creating Variables and Constants + * In this file you should define the following variables with the exact names + * + * 1. fullName -> assign it a value of your full name + * 2. yearOfBirth -> assign it a value of your year of birth + * 3. hobby -> assign it a value of your favorite hobby + * 4. funFact -> assign it a value of some fun fact about yourself + * 5. image -> assign it a value of a url of your image or ant image that represents you online + */ +Object.defineProperty(exports, "__esModule", { value: true }); +exports.hobbyString = exports.ageString = exports.fullNameString = exports.image = exports.funFact = exports.hobby = exports.yearOfBirth = exports.fullName = void 0; +exports.incrementBy1 = incrementBy1; +exports.incrementBy2 = incrementBy2; +exports.decrementBy1 = decrementBy1; +exports.decrementBy2 = decrementBy2; +var fullName = "Zainab AlSaffar"; +exports.fullName = fullName; +var yearOfBirth = 2003; +exports.yearOfBirth = yearOfBirth; +var hobby = "Photography"; +exports.hobby = hobby; +var funFact = "I once went to the cinema 10 times in one month!"; +exports.funFact = funFact; +var image = "https://www.google.com/url?sa=i&url=https%3A%2F%2Fwww.capitalccg.ac.uk%2Fnews%2Fhow-to-become-a-software-engineer&psig=AOvVaw3CYe97skUvKRnh3wYpzL6J&ust=1741337398354000&source=images&cd=vfe&opi=89978449&ved=0CBQQjRxqFwoTCNiw1L2J9YsDFQAAAAAdAAAAABAE"; +exports.image = image; +/** + * Part 2: String Interpolation + * Create the following new variables that interpolate + * the variables defined above into strings. + * + * 1. fullNameString -> assign it: "My name is {fullName}"" + * 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}"" + */ +var fullNameString = "My name is ${fullName}"; +exports.fullNameString = fullNameString; +var ageString = "I am ${2025 - yearOfBirth}"; +exports.ageString = ageString; +var hobbyString = "My hobby is ${hobby}"; +exports.hobbyString = hobbyString; +/** + * Part 3: Re-assignment + * Increment your hacker score + * */ +var hackerScore = 0; +function incrementBy1() { + // Increment hackerScore by 1 👇🏻 + hackerScore = hackerScore + 1; +} +function decrementBy1() { + // decrement hackerScore by 1 👇🏻 + hackerScore = hackerScore - 1; +} +function incrementBy2() { + // Increment hackerScore by 2 👇🏻 + hackerScore = hackerScore + 2; +} +function decrementBy2() { + // decrement hackerScore by 2 👇🏻 + hackerScore = hackerScore - 2; +} diff --git a/src/variables.ts b/src/variables.ts index bd5e775..f98ca58 100644 --- a/src/variables.ts +++ b/src/variables.ts @@ -9,11 +9,12 @@ * 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 = "Zainab AlSaffar"; +let yearOfBirth: number = 2003; +let hobby: string = "Photography"; +let funFact: string = "I once went to the cinema 10 times in one month!"; +let image: string = + "https://www.google.com/url?sa=i&url=https%3A%2F%2Fwww.capitalccg.ac.uk%2Fnews%2Fhow-to-become-a-software-engineer&psig=AOvVaw3CYe97skUvKRnh3wYpzL6J&ust=1741337398354000&source=images&cd=vfe&opi=89978449&ved=0CBQQjRxqFwoTCNiw1L2J9YsDFQAAAAAdAAAAABAE"; /** * Part 2: String Interpolation @@ -25,9 +26,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 ${2025 - yearOfBirth}`; +let hobbyString: string = `My hobby is ${hobby}`; /** * Part 3: Re-assignment @@ -38,16 +39,20 @@ let hackerScore = 0; function incrementBy1() { // Increment hackerScore by 1 👇🏻 + hackerScore = hackerScore + 1; } function decrementBy1() { // decrement hackerScore by 1 👇🏻 + hackerScore = hackerScore - 1; } function incrementBy2() { // Increment hackerScore by 2 👇🏻 + hackerScore = hackerScore + 2; } function decrementBy2() { // decrement hackerScore by 2 👇🏻 + hackerScore = hackerScore - 2; } // Ignore this part (: