Click here to Skip to main content
15,885,980 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:

hi,
I am using a javascript for loop in mongodb but i am getting multiple syntax errors or unexpected token errors, i am new to both the languages so i am not able to pinpoint the cause of the error, can you please help me by reviewing the below piece of code and letting me know where i went wrong

for(i=0; i<=3; i++) { cars = ["BMW"; "Mercedes"; "Audi"]; db.test_coll.insert("car_name": cars[i])}
Posted

1 solution

Arrays in javascript are separated by commas : http://www.w3schools.com/js/js_arrays.asp[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900