London | 26-ITP-Jan | Maryanne Mosonik | Sprint 3 | Dead Code#1068
London | 26-ITP-Jan | Maryanne Mosonik | Sprint 3 | Dead Code#1068Maryanne-K wants to merge 3 commits intoCodeYourFuture:mainfrom
Conversation
There was a problem hiding this comment.
This file will throw an error when run. Can you spot why?
There was a problem hiding this comment.
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.
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.
@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.
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.
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.
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.
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.
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.
@hkavalikas Please see the screenshot of the corrected code.
There was a problem hiding this comment.
Can you send me the output you are getting when running Sprint-3/3-dead-code/exercise-2.js?
|
Quick follow-up @Maryanne-K , waiting for your reply |
Self checklist
This PR is the dead code section of Sprint 3.
I agree to follow the code of conduct for this organisation.