FAQ: Debugging JavaScript Code - Locating Silent Bugs

Actually guys, you are supposed to first put one console.log(word); before the if statement and then a console log with the message like in the step lesson, within the if statement. But when you put them is the problem, the timing before you complete each step.

function capitalizeASingleWord(word) {

// This print statement was added to print out the ‘word’ passed into the function

// console.log(word);

if (word.match(’ ')) {

// This print statement also shows that the 'word' variable prints correctly as well, meaning that the error is HERE bcs it does not print 'hey ho', but prints only 'hey' - the opposite behavior we expected and reason why is because the '!' exclamation mark is not supposed to be there. It negates our condition!

// console.log('Word value inside of if statement: ' + word);

return null;

}

Exactly! Just follow the instructions exactly as they say and you should be fine to go! :slight_smile:

I think there is a bug. I cleared the workspace and followed the instructions a 2nd and 3rd time, exactly as written and it did not work. I even copied+pasted their console log statement to make sure there were no typos. The only way I got it to clear was by removing the bug. Then #3 turned green. Then just ran it again and #4 turned green as well.