+ 1
Let code having problem!
What,s the problem:- let selectedColors =["red,blue"]; selectedColors[2] ="green"; console.log(selectedColors) When code run it,s show some () brackets why?
18 odpowiedzi
+ 4
let selectedColors = ["red","blue"];
+ 3
well, such console output must be done by a browser console (in sololearn console is emulated, even in web version), meaning by running your html (js) file as standalone inside a browser ^^
the most near result in sololearn would be to use:
console.log(JSON.stringify(selectedColors));
but that doesn't give you a clickable output wich can expand the array content as a tree ^^
+ 2
Its running okay for me.
Paste your codes in a code playground and paste the link here.
+ 2
Thanks visph
+ 1
For me it,s showing
(
"red,blue",
"<null>",
green
)
+ 1
Ok me trying this code wait please
+ 1
Thanks,let me check
+ 1
Now it,s also showing this
(
red,
blue,
green
)
+ 1
bracket are showed in web version of code playground console... on my app version they are just showed as red,blue,green... don't know how it is showed in recent version of app (or even in iOS app)
to control how they are outputed, convert the array explicitly to a string:
console.log(selectedColors.join(" : "));
+ 1
So it,s mean ewherytime code change so what,s the benifit to learn code☹️
+ 1
but i love coding 😁
+ 1
no it means than console implementations are not always the same... but console is usually used to debug, not to final output ^^
to final output you must use html document as target ;P
+ 1
I want to make like this https://youtu.be/oigfaZ5ApsM
+ 1
Ok thanks😁
+ 1
Let selectedColor = ["red","blue"]
paste this role in your code and your code is run
0
Ok
0
Physics?