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

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++;
  };

yep - needs more tests

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

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?

Sorry for the delayed response. You may file an issue at Sign in to GitHub · GitHub