Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

JavaScript

Cannot match Guil's Console Results @ 1:34 of this Video

Video Link: https://teamtreehouse.com/library/select-all-elements-of-a-particular-type

At 1:34, Guil types in the const myParagraph and defines it into the console. The results is "undefined".

Guil then types "myParagraph.lenght" into the console and a "1" is returned: told in the video that only one "p" element is in the web page.

I attempted to mimic Guil, proofreading for typographical errors, and I receive "Uncaught ReferenceError: myParagraph is not defined(...)"

Guil then types "myParagraph[0]" into the console at it reads what it read.

I again attempted to mimic Guil, proofreading for typographical errors, and I again receive "Uncaught ReferenceError: myParagraph is not defined(...)"

I continue to have this issue through time stamp 4:45 of the video.

Basically, if my coding is not on saved on the workspace, I cannot get variables to hold a value.

I am using a very old version of Opera Browser.

2 Answers

Doron Geyer
seal-mask
.a{fill-rule:evenodd;}techdegree
Doron Geyer
Full Stack JavaScript Techdegree Student 13,897 Points

Hi Michael Dunagan , the first thing I would recommend is for you to update the browser you are using and preferably install and switch to chrome as most of the course content focuses on and uses a lot of chrome dev tools. Chrome also has far more robust support.

As for the issue you are facing if you are getting the error listed generally it means that the variable declaration did not work due to either an incorrectly named variable or a syntax error of some kind.

if you access any web page that has p tags which would be most of them then let myParagraph = document.querySelectorAll('p') should return an array of p tags. selecting myParagraph[0] would just return the value of the very first p tag in that array. generally when you define a variable in the console, it will give you undefined.

the reason for this is complicated and probably not going to do much for you , but if you're interested in the why https://www.reddit.com/r/learnjavascript/comments/68k3co/variable_declaration_returns_undefined_in_console/

Hello Mr. Geyer

Thank for the reply. I will check out what you recommend.

I bought a "newer" computer that has Windows 10 to allow the latest version of PHP Storm. I just hang on to this relic because I am embattled in a court case where I won judgement but the other side has appealed. Hence, I do much typing of MOTIONS and briefs since I am my own lawyer. This relic machine is the only one with Office products on it. I should buy more licenses.

Mike

Doron Geyer
seal-mask
.a{fill-rule:evenodd;}techdegree
Doron Geyer
Full Stack JavaScript Techdegree Student 13,897 Points

Michael Dunagan , you're welcome. You could also make use of googles online office suite, google docs/sheets. Or just grab a copy of libra office which is a free opensource office suite.

best of luck .

UPDATE: I switch to archaic CROME browser and I am still getting the same errors. For the Chrome browser, I had to use a semi-colon at the end of the statement, unlike Opera and unlike Gil in the video. Without it, Chrome console though I was trying to operate a function.

Arrrgggghhhhhh......I had to install my newer computer because I am not sure I have the Internet connection CD handy. Grrrrrr.