Back to Freecodecamp

Step 6

curriculum/challenges/english/blocks/workshop-balance-sheet/61fd6b7c83dbf54a08cf0498.md

latest1.6 KB
Original Source

--description--

Within your div element, add three span elements. Give each of them a class attribute set to year, and add the following text (in order): 2019, 2020, and 2021.

--hints--

Your div element should have three span elements.

js
assert.lengthOf(document.querySelector('div')?.children, 3);

Each span element should have a class attribute set to year.

js
const spans = [...document.querySelector('div')?.children];
spans.forEach(span => assert.isTrue(span?.classList?.contains('year')));

Your first span should have the text 2019.

js
assert.strictEqual(
  document.querySelector('div')?.children?.[0]?.textContent.trim(),
  '2019'
);

Your second span should have the text 2020.

js
assert.strictEqual(
  document.querySelector('div')?.children?.[1]?.textContent.trim(),
  '2020'
);

Your third span should have the text 2021.

js
assert.strictEqual(
  document.querySelector('div')?.children?.[2]?.textContent.trim(),
  '2021'
);

--seed--

--seed-contents--

html
<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Balance Sheet</title>
    <link rel="stylesheet" href="./styles.css" />
  </head>
  <body>
    <main>
      <section>
        <h1>
          <span class="flex">
            <span>AcmeWidgetCorp</span>
            <span>Balance Sheet</span>
          </span>
        </h1>
--fcc-editable-region--
        <div id="years" aria-hidden="true">
        </div>
--fcc-editable-region--
      </section>
    </main>
  </body>
</html>
css