https://beta.freecodecamp.org/en/challenges/data-visualization-with-d3/change-styles-based-on-data
Going through the D3 challanges in beta, there are multiple ones that have always show the error "Identifier 'dataset' has already been declared." It appears to be a bug because the solution works if the const dataset
line is commented out.
This happened on chrome. I checked and can't reproduce this error in Firefox quantum.
<body>
<script>
const dataset = [12, 31, 22, 17, 25, 18, 29, 14, 9];
d3.select("body").selectAll("h2")
.data(dataset)
.enter()
.append("h2")
.text((d) => (d + " USD"))
// Add your code below this line
// Add your code above this line
</script>
</body>
I tested this and a few other cases that use const dataset
on later versions of Chrome (62 and 63) and got no errors.
I believe this issue has been fixed as part of this PR: #16149
Tests are now being executed in a fresh frame, which prevents the collision with the scope from previous run.
Yes, thanks a lot for confirming.
Most helpful comment
I tested this and a few other cases that use
const dataset
on later versions of Chrome (62 and 63) and got no errors.