freeCodeCamp/curriculum/challenges/arabic/04-data-visualization/data-visualization-with-d3/add-classes-with-d3.arabic.md

1.0 KiB

id title challengeType videoUrl localeTitle
587d7fa7367417b2b2512bc8 Add Classes with D3 6

Description

undefined

Instructions

undefined

Tests

tests:
  - text: ''
    testString: 'assert($("div").attr("class") == "bar", "Your <code>div</code> elements should have a class of <code>bar</code>.");'
  - text: ''
    testString: 'assert(code.match(/\.attr/g), "Your code should use the <code>attr()</code> method.");'

Challenge Seed

<style>
  .bar {
    width: 25px;
    height: 100px;
    display: inline-block;
    background-color: blue;
  }
</style>
<body>
  <script>
    const dataset = [12, 31, 22, 17, 25, 18, 29, 14, 9];

    d3.select("body").selectAll("div")
      .data(dataset)
      .enter()
      .append("div")
      // Add your code below this line



      // Add your code above this line
  </script>
</body>

Solution

// solution required