-
Notifications
You must be signed in to change notification settings - Fork 76
Zainab AlSaffar Variables task #9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -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; | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This code works today, works tomorrow and will work next month. But will it work next year?
Think about how we can make our code always work correctly.