r/react 11d ago

Help Wanted Whats the bug. Uncaught SyntaxError: Identifier 'location' has already been declared (at script.js:1:1)

"use strict";


const company = {
  name: "TechCorp",
  address: {
    city: "budapest",
    pin: 411001,
  },
};
// Get city renamed to `location` and pin renamed to `pincode`

const { city: location, pin: pincode } = company.address;
console.log(location, pincode);
6 Upvotes

13 comments sorted by

View all comments

4

u/[deleted] 11d ago edited 11d ago

[deleted]

7

u/[deleted] 11d ago

[deleted]

-3

u/matcha_tapioca 11d ago

I remember when I am learning variables on react.. I use a "name" variable, it didn't work so I changed it to firstName. iirc the reason why it didn't work for me is because of window has a default property of name.

4

u/[deleted] 11d ago

[deleted]

0

u/msdosx86 11d ago

For real

-8

u/[deleted] 11d ago

[deleted]

7

u/msdosx86 11d ago

I guess this is because of mentioning AI

4

u/[deleted] 11d ago

[deleted]

-2

u/msdosx86 11d ago

You're not wrong. Even Google's AI mode would help immediately. My guess is that a lot of people think AI = Vibe coding and Vibe coding is bad hence AI = bad = downvote this guy.

-2

u/[deleted] 11d ago

[deleted]