generated from CodeYourFuture/Module-Template
-
-
Notifications
You must be signed in to change notification settings - Fork 336
London | 26-ITP-Jan | Maryanne Mosonik | Sprint 3 | Dead Code #1068
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
Open
Maryanne-K
wants to merge
3
commits into
CodeYourFuture:main
Choose a base branch
from
Maryanne-K:coursework/dead-code
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
3 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
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
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 file will throw an error when run. Can you spot why?
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.
I tested the code and it hasn't thrown an error. I only deleted parts that were unnecessary in the code, its still running ok and giving me an output. Should I return the original code?
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.
Can you send me the output you are getting when running
Sprint-3/3-dead-code/exercise-2.js?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.
@hkavalikas Apologies for the late reply, completely forgot I hadn't sent a reply. I'm getting Hamster 3, Horse 1
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.
Hey @Maryanne-K , that's absolutely fine. Can you do me a favour and add the contents of your file to the browser console (F12 -> Console tab) and let me know if you are getting the same results?
The version committed on git is missing something that should throw errors for all IDEs and runtime environments, so unless you have a different version of your code locally, I'm confused as to how it would work for you 😅
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.
Not sure why its working but I went through the code again and made changes to it, I added back the following:
const petsStartingWithH = pets.filter((pet) => pet[0] === "h");
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.
Awesome, thank you for sending it over! Do you see the blue arrow on the first line
// Remove ...? That means the code was indeed pasted, but you haven't run it yet. The grey "results" you see towards the end are the comments added in the code// { 'HAMSTER': 3, 'HORSE': 1 } <- Final console log. While you are on that screen, can you press "Enter", run these lines and copy over what you see?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.
Perfect, that was the part that was missing! Before we mark this PR as completed, can I ask you to run the code on the console and send a screenshot of that? You can either run the code that would throw the error or your new one; either of them will work!
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.
Yes, I see the issue now, petsStartingWithH wasn't defined. I've defined it and updated the code. Thank you!
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.
@hkavalikas Please see the screenshot of the corrected code.