I'm doing some javascript exercises on code wars. I want to see what's going wrong in my programs by printing to the console, but nothing except the test results appears in the output window. Does anyone know how to print to the console in code wars? I can't find anything in their documentation.
function areYouPlayingBanjo(name) {
// Implement me
var person = name.split('');
person[0].toLowerCase();
console.log(person[0]);
if(person[0] === 'r'){
return name + " plays banjo";
}
else{
return name + " does not play banjo";
}
}
I'm doing some javascript exercises on code wars. I want to see what's going wrong in my programs by printing to the console, but nothing except the test results appears in the output window. Does anyone know how to print to the console in code wars? I can't find anything in their documentation.
function areYouPlayingBanjo(name) {
// Implement me
var person = name.split('');
person[0].toLowerCase();
console.log(person[0]);
if(person[0] === 'r'){
return name + " plays banjo";
}
else{
return name + " does not play banjo";
}
}
Share
Improve this question
asked Dec 6, 2014 at 5:49
user137717user137717
2,1854 gold badges28 silver badges51 bronze badges
5
- Without a code no one can help you – Just code Commented Dec 6, 2014 at 5:52
-
What value for
name
is being passed? – Arthur Weborg Commented Dec 6, 2014 at 5:56 - 1 Rikke, rikke and Martin, but they all print name + " does not play banjo" I just want to know how to print to console in code wars because console.log isn't doing it – user137717 Commented Dec 6, 2014 at 5:58
- @BatScream "ReferenceError: print is not defined at areYouPlayingBanjo" is what i get for print(person[0]); – user137717 Commented Dec 6, 2014 at 6:38
-
Okay, my bad ;-(, no
print
function. – BatScream Commented Dec 6, 2014 at 6:42
2 Answers
Reset to default 1This worked for me:
Console.Out.WriteLine("Print stuff to output here.");
This is not exactly an answer to the question, but more of an extended answer in order to document a chrome extension that can allow debugging in the console for codewars.
Install this chrome extension: https://github./bojan88/Codewars-JavaScript-debugger
This allows you to use the debugger;
statement to force the your code to run in the browser rather than the sandboxed environment on the codewars servers. Works great.
Caveat: I don't know if this is safe. Use at your own risk.