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 JavaScript and the DOM (Retiring) Getting a Handle on the DOM Select All Elements of a Particular Type

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

not working as shown in the video

using

const myParagraph = document.getElementsByTagName('p')

gives me the error

Uncaught SyntaxError: Identifier 'myParagraph' has already been declared at <anonymous>:1:1

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

so seems like there's some issue with the const "myParagraph". when I change the given name to const "testIt" then the code works as shown in the video.

I am using the default workspace provided for the video and I also deleted the workspace and restarted it anew to assure that it was not a change I had made by mistake.

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

KRIS NIKOLAISEN for some reason I cant respond to your below post. the workspace used was the default one and the commands that are giving errors were entered under console.log so cant really post it here as such. I followed the video info as prescribed.

The only change that I made to get it to work properly was the name of the const. nothing else.

1 Answer

Can you post a snapshot of your workspace with the const myParagraph error?