question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

It seems that my code passes every test condition when I test it in the console, yet all but one of the tests are showing failure. Help?

See original GitHub issue

Challenge Where do I belong has an issue. User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36. Please describe how to reproduce this issue, and include links to screenshots if possible.

My code:


function getIndexToIns(arr, num) {
  arr.sort(function(a,b){return a-b;});
  for(var i in arr){
    if(arr[i]>=num){
      return i;
    }
  }
  return arr.length;
}

getIndexToIns([10, 20, 30, 40, 50], 35);

All parts of the challenge seem to be passed by the code above, yet almost all of the conditions are showing as failed.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
Margaret2commented, Jun 9, 2017

@bduncan136 Your function is returning a string instead of a number. That’s probably the problem.

0reactions
raisedadeadcommented, Jun 9, 2017

Please proceed on the chat or the forum, this tracker is not for coding assistance.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Hide console logging for passing tests and show it for failures
A custom reporter can only show output for the suite (i.e. a test file), not a specific failing test.
Read more >
Tests not running in Test Explorer - visual studio
However, the tests are not running when using the Visual Studio test explorer. The Test Explorer is showing all unit tests, but once...
Read more >
Why do Apex Unit Test CLASSES sometimes FAIL when all ...
i.e. the tests methods pass, but then an exception happens when cleaning up, storing code coverage, setting values on the test result object, ......
Read more >
Why tests pass locally but fail in Jenkins | Object Partners
The first thing you want to do is determine the source(s) of your leak (the data that is persisting into other test cases)....
Read more >
Troubleshooting Your Solution | The Codewars Docs
Your solution seems to work or is close to working, but still fails tests​ ... “TEST”, only sample tests are run – the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found