Quiet Rules problem (If statements) | Sololearn: Learn to code for FREE!
Novo curso! Todo programador deveria aprender IA generativa!
Experimente uma aula grƔtis
+ 3

Quiet Rules problem (If statements)

Hello! Iā€™m having a tough time getting the output ā€œObey the rulesā€ for just Sunday out of all the days of the week in this code challenge. Any help is much appreciated!

22nd Dec 2020, 2:01 PM
Nick Carothers
15 Respostas
+ 4
Nick Carothers show your attempt
22nd Dec 2020, 2:06 PM
Krish
Krish - avatar
+ 3
if (day1 == day) { console.log(rules) ; } day is the input And also it will be == and not =
22nd Dec 2020, 3:21 PM
Krish
Krish - avatar
23rd Dec 2020, 6:56 AM
Krish
Krish - avatar
+ 2
md saif Don't spam
23rd Dec 2020, 6:16 PM
AĶ¢J
AĶ¢J - avatar
24th Dec 2020, 11:01 AM
Krish
Krish - avatar
+ 2
Nick Carothers I was not saying to you. I said to md saif who was spamming in QA.
24th Dec 2020, 4:34 PM
AĶ¢J
AĶ¢J - avatar
+ 2
Okay cool just wondering. Thank you!
24th Dec 2020, 4:38 PM
Nick Carothers
+ 1
hmmm I tried that and it still didnt work
22nd Dec 2020, 6:46 PM
Nick Carothers
+ 1
Iā€™m not spamming. Just trying to figure out a problem. Was that directed towards me or someone else?
24th Dec 2020, 10:55 AM
Nick Carothers
+ 1
Finally got it! Thanks for the help!
24th Dec 2020, 4:48 PM
Nick Carothers
+ 1
Hi Darryl. Since the day variable equals all the days, and the rules variable equals ā€œobey the rulesā€, I created a Sunday variable which equals ā€˜Sundayā€™. i then used an if statement to compare the Sunday variable to the day variable, then console.log(). I donā€™t want to give it away. Find out which comparison operator between Sunday and day, and what I put in the console.log() to solve the problem. Hopefully this helps some!
9th Jan 2021, 3:25 PM
Nick Carothers
0
i could use some assistance on this one too
8th Jan 2021, 3:28 PM
Darryl T. Davis
0
yes i figured it out and was easier than i thought
9th Jan 2021, 5:41 PM
Darryl T. Davis
0
nice!
9th Jan 2021, 8:17 PM
Nick Carothers
- 1
function main() { var day = readLine(); var rules = 'Obey the rules'; // Your code goes here var day1 = 'Sunday' if (day1 = rules); console.log(rules); }
22nd Dec 2020, 3:08 PM
Nick Carothers