-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
Cannot get Practice 03_12 to work. #8
Comments
I am having the same error when using this exercise file ("03_12") |
Try Using this : http://127.0.0.1:5500/Practice/03_12/index.html
Jacquelyn Hagman
***@***.***
… On Nov 8, 2021, at 10:56 PM, AndrewIzatt ***@***.***> wrote:
I am having the same error when using this exercise file ("03_12")
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub <#8 (comment)>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/ARI734F76YSCDVSCXLTDP43ULCSZVANCNFSM4ZCMN2VA>.
|
Do you get an error when loading the regular files?
|
Also do you have your server started??
Jacquelyn Rene’ Hagman
Scrum Master /Budding Web Developer
… On Nov 9, 2021, at 9:26 PM, Jacquelyn Elder ***@***.***> wrote:
Do you get an error when loading the regular files?
|
Sorry that was a long sentence! lol |
Are you clicking the port button 5500 to deploy the server?? If it’s deployed already it will tell you it is stopping. Then hit it again to redeploy. As far as the error code I would need to see your actual code. You can send a screen shot of it. Make sure you send screen shots of the code in all files that have to do with the code.
Jacquelyn Rene’ Hagman
Scrum Master /Budding Web Developer
… On Nov 10, 2021, at 8:53 AM, AndrewIzatt ***@***.***> wrote:
Sorry that was a long sentence! lol
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub, or unsubscribe.
|
So I get that error too. It’s a scope issue. Once the code is deployed and the file is run through we are taken out of scope (basically what we are able to see). The only way to call it from the console like that would be to use a window object and write it into the code in the script file. But you don’t really want to do that cuz it pollutes the global scope. I’ll send you the documentation on it once I get to my computer.
Jacquelyn Rene’ Hagman
Scrum Master /Budding Web Developer
… On Nov 10, 2021, at 7:25 PM, AndrewIzatt ***@***.***> wrote:
Wow thank you so much for your help. I really didn't expect this much attention. But I am very grateful! Here is my HTML:
Here is my JavaScript (main):
Here is my Instrument class in a separate JavaScript file:
And finally here is my Drink class:
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub, or unsubscribe.
|
I tested in the instructors code also and that’s where (you see in my last reply) the window object written in. So it’s nothing you are doing wrong. You just can’t access the information you are wanting to access once outside the file.
Jacquelyn Rene’ Hagman
Scrum Master /Budding Web Developer
… On Nov 11, 2021, at 7:38 AM, Jacquelyn Elder ***@***.***> wrote:
So I get that error too. It’s a scope issue. Once the code is deployed and the file is run through we are taken out of scope (basically what we are able to see). The only way to call it from the console like that would be to use a window object and write it into the code in the script file. But you don’t really want to do that cuz it pollutes the global scope. I’ll send you the documentation on it once I get to my computer.
Jacquelyn Rene’ Hagman
Scrum Master /Budding Web Developer
>> On Nov 10, 2021, at 7:25 PM, AndrewIzatt ***@***.***> wrote:
>>
>
> Wow thank you so much for your help. I really didn't expect this much attention. But I am very grateful! Here is my HTML:
>
> Here is my JavaScript (main):
>
> Here is my Instrument class in a separate JavaScript file:
>
> And finally here is my Drink class:
>
>
> —
> You are receiving this because you commented.
> Reply to this email directly, view it on GitHub, or unsubscribe.
|
Wow thank you so much. I'm super new to JavaScript (I just started this week!) so I don't really understand what you're saying but I'm glad to know at least my syntax isn't wrong. I'd have wished that LinkedIn Learning's files would be airtight but I guess you can't even count on that. This really derailed me for a while trying to figure out what the issue was before I posted my question so thank you so much for your help! |
Absolutely. No problem at all!
Some errors aren’t really ones that are in our control (like scope).
Start by looking the error up in google and usually you will come across documents like the stack overflow one I sent you. You can also take all the classes and copy paste them into your script file to test that way. Just make sure they are in the proper tag <script> so the data is available.
Then just comment out your imports and exports in your js files. Just don’t mess with the script link you are using in the html file.
That’s a way to test to see if the file is corrupted.
Also, using the debugger is helpful to be able to see what is happening on each line of code.
If you have any more questions don’t hesitate to ask. This helps me learn too. My email is ***@***.*** we can also connect on linked in if you want. https://www.linkedin.com/in/jacquelyn-hagman-52605458
Jacquelyn Rene’ Hagman
Scrum Master /Budding Web Developer
… On Nov 11, 2021, at 7:38 PM, AndrewIzatt ***@***.***> wrote:
Wow thank you so much. I'm super new to JavaScript (I just started this week!) so I don't really understand what you're saying but I'm glad to know at least my syntax isn't wrong. I'd have wished that LinkedIn Learning's files would be airtight but I guess you can't even count on that. This really derailed me for a while trying to figure out what the issue was before I posted my question so thank you so much for your help!
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub, or unsubscribe.
|
Issue Overview
Scope issue with classes.
Describe your environment
Windows 10 19041, Chrome 88 or Edge, atom 1.55.0, atom-live-server
Steps to Reproduce
Working directly in the file structure provided, I add the following to the empty
script.js
.In the browser console it prints the mybackpack as I expect. But if I then try to access
mybackpack.name
or anything ofmybackpack
it returns the following error:Expected Behavior
Being able to access
mybackpack
from the console as in previous chapters.Current Behavior
mybackpack
is not part of the scope.Possible Solution
Copying the class definition of
Backpack
intoscript.js
and and removing pointers toBackpack.js
(inindex.html
as well as inscript.js
) helps.To be honest, I think the presence of
Backpack.js
is just confusing for this exercise and not needed to work through the given tasks.Screenshots / Video
Related Issues
The text was updated successfully, but these errors were encountered: