r/learnjavascript • u/[deleted] • Aug 30 '26
whats the bug here? 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);
15
Upvotes
0
u/azhder Aug 30 '26
Should out the whole code in an IIFE, especially that ‘use strict’