+ 4
[SOLVED] JavaScript course code coach
I can't solve a code coach problem of the JavaScript course. The output is exactly as expected. I am posting a screenshot and the code I wrote. Thanks for the help! https://www.sololearn.com/post/759090/?ref=app https://code.sololearn.com/WBYrdok0Hr03/?ref=app
7 Antworten
+ 5
The formatting done by console.log() might be different from what you implement manually. In this case, it would work if you used two spaces instead of the two tabulator characters to align the items.
That's hardly worth it though, just use
console.log( breakfasts );
and it should match automatically, no need to format it by yourself.
+ 5
You can use \t with console.log(), what I was trying to say is that the code coach solution (which could be obtained from console.log) might not use \t as whitespace character in the formatting, and then the character-by-character comparison between the output and the solution would fail.
However, I am not enough into JS to know what the implemention looks like or if it is absolute standard, i.e. behaves equally in all browsers and their respective versions. I would guess so, but can't confirm it. Maybe someone with more JS experience would know more.
+ 4
It works with the spaces. So the \t is not to be used with console.log()?
Also I tried console.log( breakfasts ); and it printed the bracket and all the rest. Is this some kind of standard formatted output for arrays in js?
+ 4
Shadow thank you so much for your explanations 🤗
0
console.log("Solving my first JavaScript Code Coach!");
0
But it shows errors when I type, console.log("Solving my first JavaScript Code Coach! ") Please suggest me how to right code
0
And I also tried these like, console.log(solving my first JavaScript Code Coach!) but it also failed