+ 12

i am getting a SyntaxError when i run this code. Please debug it.

1. var english = "string1" 2. var korean = "string2" . . . 19. var binary = "string3" 20. var lang = [ english , hindi russian , chinese......binary]; (there are 16 variables in the list where all are defined ) 21. var rand = Math.floor(Math.random()*16); var RandomLanguage = lang [rand] what i want it to do it is, give me different language in the place of lang[ rand ] every time i run the code. But what happens is i get a SyntaxError on line 20 saying Unexpected Identifier line: 20

31st Mar 2017, 4:14 PM
Code Ninja
Code Ninja - avatar
5 Respuestas
+ 2
The problem is probably the missing comma after hindi.
1st Apr 2017, 2:48 AM
Luca Garrera
+ 10
The 'm' should be capital and not in lowercase letters. Since javascript is case sensitive, be careful with uppercase and lowercase terms
31st Mar 2017, 11:46 AM
Chirag Bhansali
Chirag Bhansali - avatar
+ 9
my apologies guys, the previous question was incomplete one but it complete now what you two guys (Chirag and Tiago) are saying is corrected but the problem is, that's not where it was showing error. Instead it was showing error on line 20 ( which it still is even after the m is corrected ) pl help.
31st Mar 2017, 4:09 PM
Code Ninja
Code Ninja - avatar
+ 3
Can you provide the link to code playground..It's difficult to identify with what you have provided.
31st Mar 2017, 4:46 PM
Ashwani Kumar
Ashwani Kumar - avatar
+ 1
I assumed it was JavaScript, don't forget to tag. in case it is, last line should be: var rand = Math.random(); notice how it is case-sensitive (correct is Math NOT math)
31st Mar 2017, 11:47 AM
Tiago Silva
Tiago Silva - avatar