This code passes all the tests, but it definitely does not work as intended


#1

Challenge Name

Add Elements at a Specific Index in a Linked List has an issue.

Issue Description

This code definitely does not add an element at a given index. Suddenly, it have passed all the tests.

Browser Information

User Agent is: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3158.0 Safari/537.36.

Screenshot

Your Code


this.addAt = function(index, element) {
    var currentNode = head;
    var previousNode;
    var node = new Node(element);
    if(index > length || index < 0) {
      return false;
    } else if(index === 0) {
      node.next = head;
      head = node;
    }
    length++;
  };

#2

yep - needs more tests


#3

It’s beta, please file the issue through Github.com


#4

The same issue holds true on “Data Visualization with D3: Add Axes to a Visualization.” My question is where on github would I post this?


#5

Sorry for the delayed response. You may file an issue at https://github.com/freeCodeCamp/freeCodeCamp/issues/new