my .js file has array json data as below
array1 =[{"id":"100","name":"abc","group":"123"}
{"id":"102","name":"def","group":"456"}
{"id":"103","name":"ghi","group":"789"}]
and i send data to html as below
app.post('/lms',function(req,res){
res.render('indextest',{data:array1});});
now i am able to access the above data in my indextest.html as below
<%= data[0].id%>
but my requirment is i want to access this data in a for loop
for(i=0;i<len;i++){
var id= <%= data[i].id%>;
document.write("<input type=\"checkbox\" name=\"bedID\" value=\""+id+"\">");}
here i am getting "i" is undefined and i pass as below
var id= '<%= data['+i+'].id%>';
i get id not defined
can some one help me in any other way to acces the data in the loop or fix the above issue thanks