+ 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

13th Nov 2020, 3:00 PM
Davide
Davide - avatar
7 ответов
+ 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.
13th Nov 2020, 3:16 PM
Shadow
Shadow - avatar
+ 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.
13th Nov 2020, 3:41 PM
Shadow
Shadow - avatar
+ 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?
13th Nov 2020, 3:26 PM
Davide
Davide - avatar
+ 4
Shadow thank you so much for your explanations 🤗
13th Nov 2020, 3:57 PM
Davide
Davide - avatar
0
console.log("Solving my first JavaScript Code Coach!");
4th Mar 2023, 5:39 PM
Mistry Jainam
Mistry Jainam - avatar
0
But it shows errors when I type, console.log("Solving my first JavaScript Code Coach! ") Please suggest me how to right code
26th Mar 2023, 8:03 AM
Aishwarya Kashinath Manikonda
Aishwarya Kashinath Manikonda - avatar
0
And I also tried these like, console.log(solving my first JavaScript Code Coach!) but it also failed
26th Mar 2023, 8:06 AM
Aishwarya Kashinath Manikonda
Aishwarya Kashinath Manikonda - avatar