Test Failing due to incorrect solution

Question in which the test falied:

As per the Task mentioned we are suppose to

1.  Create a variable `container1` linked to the id associated with 'High priority tasks' using `document.getElementById()`

2. Create a variable `contentItem1` to store the value returned by the function `createContentElement(contentDescription, contentDate)`

3.  Append `contentItem1` to the 'High priority tasks'
  • Here we are expected to create container1 which is linked to html tag with the id highPriorityContainer then,

  • We create variable to store the contentItem that is returned by function createContentElement()

  • Finally we are suppose to append the contentItem to the container1 or 2 depending the IF-Else condition.
    Here is my code as per the Task statements

      var container1 = document.getElementById('highPriorityContainer');
      var contentItem1 = createContentElement(contentDescription, contentDate);
      container1.appendChild(contentItem1);

My test failed a few times, prompting me to check the solution where i found that the expected solution is as follows

      var container1 = document.getElementById("highPriorityContainer");
      var contentItem1 = createContentElement(contentDescription, contentDate);      
      highPriorityContainer.appendChild(contentItem1);

I think that this line highPriorityContainer.appendChild(contentItem1); is incorrectly mentioned as we never created a variable named highPriorityContainer and it rather should be container1.appendChild(contentItem1); which we declared in the first line.

Please suggest if that is a bug or am i misunderstaning the task statements.

Apologies, you’re absolutely right! We appreciate your keen eye and effort. Thanks for pointing it out—keep up the great work!

1 Like