zachgoll / fullstack-roadmap-series

Renamed to "Frontend Web Development for Beginners", this will help you build a solid foundation in HTML, CSS, and JavaScript as a web developer.
https://www.fullstackfoundations.com/courses/frontend-web-development-for-beginners
1.57k stars 260 forks source link

Uncaught SyntaxError: redeclaration of let secondNumber #4

Open VitaliyMahnushevskiy opened 1 year ago

VitaliyMahnushevskiy commented 1 year ago

This is a Github issue template. You will need to replace all lines marked with REPLACE. If you want to see an example issue, please refer to this one. While I will try to get to your question as quickly as possible, I am creating this series for free and therefore don't always have a ton of free time. Thanks for your understanding!

What video or post URL is your question regarding?

https://www.youtube.com/watch?v=YFVT567KBlw&list=PLYQSCk-qyTW37zDPzcAyzCsnypFQrhUcq&index=4

If it is a YouTube video, what timestamp are you asking about?

Homework tasks

What is your question?

I can't fix the Syntax error. The console error complains about the secondNumber redeclaration. Please see the code below: const myBoolean = true; const myString = 'hello world'; const firstNumber = 20; let secondNumber = 40; secondNumber = 80; const myArray = [myBoolean, myString];

const myObject = { firstProperty: myArray, sumProperty: firstNumber + secondNumber};

console.log (myObject);

const sumProp = myObject.sumProperty; console.log (sumProp);

PraveshBhatt commented 1 year ago

I ran this code in console and it works fine. There are no syntax error on my side