Modify the if condition to print "hello" and " world" both in the console..? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Modify the if condition to print "hello" and " world" both in the console..?

if(?){ console.log("hello") } else{ console.log("world") }

1st Nov 2020, 5:56 PM
Ameer Haider
Ameer Haider - avatar
5 Answers
+ 5
The following prints hello world on separate lines: if (console.log("hello")) { console.log("hello"); } else { console.log("world"); }
1st Nov 2020, 6:44 PM
Josh Greig
Josh Greig - avatar
+ 11
David Carroll I did not find such a question in SL lessons?
1st Nov 2020, 10:59 PM
Danijel Ivanović
Danijel Ivanović - avatar
+ 6
Wait... what? Is this from a SoloLearn lesson? What the heck kind of jacked up, pointless question is this?
1st Nov 2020, 10:45 PM
David Carroll
David Carroll - avatar
+ 2
Josh Greig That is brilliant! 😄
1st Nov 2020, 8:27 PM
Ore
Ore - avatar
0
Use the search bar, that will only print "hello" and not "world". The question says to print "hello" AND " world". EDIT: This refers to an answer that "Use the search bar" later deleted.
1st Nov 2020, 8:08 PM
Josh Greig
Josh Greig - avatar