0
How can you avoid repetition in js
I am working on an app that uses a database but it prints the person name from the database more than once(5 times) please help me guys
9 Respostas
+ 1
Can you write the code here please
+ 1
Just copy it to the private or in comments like a text
+ 1
Look if this is the code then there's two mistakes
1- in case help you forgot to type ":" in last of statement
2- in case date you forgot to add break;
0
Make sure it's not inside a for loop or an event.
0
Unable to post the code
0
It's not in a for loop, it's in a switch loop
0
Let me be straight, its meant to get users input and obey
var sl = prompt("Command: ");
switch (sl)
{
case "help"
alert("about, date");
break;
case "date":
var date = new Date()
alert(date);
case "about":
alert("Version 1.8");
break;
default:
alert("No such command")
break;
}
This is all so far
0
Thanks, Works perfectly
0
it could be that its in a loop.. i think thats the only possible explanation