Tell us what’s happening:
Hello! I have SOLVED the issue I was having, this is more for anyone else that might be having the similar issue. This took me longer to figure out than I’d like to admit. I searched through the forum and none of the help posts were helpful. So I’m making my own post. The code wasn’t being evaluated correctly because of my browser extension Dark Reader. Still not 100% why this was happening honestly.
Apparently new users cannot make posts containing more than 1 embedded image. I’ll be making a similar post with the second image showing the test passing.
Tests were failing even though the code and the visual panel all look correct.
SEE FIRST POST!
I opened the dev tools and noticed some “style-src” errors in the console tab. I decided to turn off Dark reader and the test passed.
PASSED!!!
Hope this helps!
**Your code so far**
<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
.style("color", (d) => {
if(d < 20) {
return "red"
} else {
return "green"
}
});
// Add your code above this line
</script>
</body>
**Your browser information:**
User Agent is: Mozilla/5.0 (X11; Linux x86_64; rv:101.0) Gecko/20100101 Firefox/101.0
Challenge: Change Styles Based on Data
Link to the challenge: