Let code having problem! | Sololearn: Learn to code for FREE!

+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 Answers

New Answer

+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

+1

For me it,s showing ( "red,blue", "<null>", green )

+1

https://code.sololearn.com/W3j4X3dCyzi9/?ref=app

+1

+1

+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

+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

+1

Let selectedColor = ["red","blue"] paste this role in your code and your code is run

0

0