+ 1

This code is an error???

var x = ""; // i forgot what i delete here 👆👆👆 switch(x) { case "tell me about you": document.write("ive been made by jingga sona"); break; case "Who are you": document.write("im a bot"); break; } why?

28th Jun 2018, 3:38 AM
Jingga Sona
Jingga Sona - avatar
10 Antworten
+ 5
var x = "Who are you"; switch(x) { case "tell me about you": document.write("ive been made by jingga sona"); break; case "Who are you": document.write("im a bot"); break; } // variable x didn't declare in u r code.
28th Jun 2018, 3:59 AM
Lakhvir Singh
Lakhvir Singh - avatar
+ 5
Jingga Sona sorry, but x is without any string value, and in yours cade have not default case.
28th Jun 2018, 4:14 AM
Lakhvir Singh
Lakhvir Singh - avatar
+ 3
It outputs an error because x is not defined. Here's a working code https://code.sololearn.com/WewZvKr2XZp1/?ref=app
28th Jun 2018, 3:48 AM
Jonathan Pizarra (JS Challenger)
Jonathan Pizarra (JS Challenger) - avatar
+ 2
Your code will produce errors simply because the clearInput() and text() functions are not defined.
28th Jun 2018, 4:10 AM
Jonathan Pizarra (JS Challenger)
Jonathan Pizarra (JS Challenger) - avatar
+ 1
Jonathan Pizarra i alredy wrote var x = bla nla bla
28th Jun 2018, 3:50 AM
Jingga Sona
Jingga Sona - avatar
+ 1
Then post the code here so we can see what's the error
28th Jun 2018, 3:52 AM
Jonathan Pizarra (JS Challenger)
Jonathan Pizarra (JS Challenger) - avatar
+ 1
Lakhvir Singh i already wrote the X... check out my code
28th Jun 2018, 4:00 AM
Jingga Sona
Jingga Sona - avatar
0
i accident delete some text and i save it...😅😅😅 Updating... Jonathan Pizarra
28th Jun 2018, 3:54 AM
Jingga Sona
Jingga Sona - avatar
0
Jonathan Pizarra Thanks for the Informations!!! Lakhvir Singh
28th Jun 2018, 6:10 AM
Jingga Sona
Jingga Sona - avatar