Novo curso! Todo programador deveria aprender IA generativa!
Experimente uma aula grƔtis+ 3
New to JavaScript and teaching myself
I am trying to prompt the user for a color, then have the console report if the user typed a primary color (red, blue, or yellow) or a secondary color (orange, green or purple) or none of these. I also want to handle the situation for both uppercase and lowercase letters in the color the user types in. https://code.sololearn.com/WI5mGKZMIcdN/?ref=app
16 Respostas
+ 6
FYI, you can't use relational operators(< ,==,>) or logical operators(||,&&) to compare an input variable with an array element unless you're using a loop.
Also, you can add Prasanth's code inside your script tag or use one of them for better look
+ 5
Is that what you want :
https://code.sololearn.com/WuYie25Jb5th/?ref=app ??
+ 3
Nick B
You have written in Java compiler not in JavaScript. Both are different.
+ 2
Rather create new web code bit, and share its link than copy/pasting raw text code.
https://www.sololearn.com/post/75089/?ref=app
+ 1
Nick,
Wrong type of code bro ...
Create your code in a new "Web" project, not "Java" project ...
Please change it.
+ 1
Nick B
Java and JavaScript are totally different programming languages dude!
+ 1
Nick B
No that's for temporary. I think you have accessed many times so SL blocked you for some time. After some time you will be able to write and run code in Web.
+ 1
Kylar Cham
It's a node js function.
0
Nick B
Single equal is used for assignment not for comparison. Use double equal (==).
0
AĶ¢J - SĶoĶlĶoĶHĶeĶlĶpĶeĶrĶ I only saw Java on the list
0
There is web option, you can write there
0
AĶ¢J - SĶoĶlĶoĶHĶeĶlĶpĶeĶrĶ I got blocked on the web version, and I donāt know why.
0
Prashanth Kumar ok just changed it
0
I was wondering, is readLine() a real JavaScript function? Because when I try to use it on another compiler, it says
Error: readLine is not defined
0
Nick B welcome to javascript
0
Hii