There is a problem with the for loop in the ejs example

  node.js, question

As the topic shows, I don’t know why I wrote it myself or what the problem is.

Html code:

< h1>[ percentage = title percentage ]</h1 >
 [percentage for(var i=0;   i<supplies.length;  I add) {console.log(supplies[i])} percentage]
 < p>[ percentage = supplies percentage ]</p >

javascript,javascript

window.onload = function(){
 var testObj = {
 title: 'Cleaning Supplies',
 supplies: ['mop', 'broom', 'duster']
 bracket
 
 dataDetailTemplate = new EJS({element: 'test-template'});
 result = dataDetailTemplate.render(testObj);
 document.getElementById('test').innerHTML = result;
 };

The result of the final promise:
最后答应出来的结果

If you change the html code:
Html code:

< h1>[ percentage = title percentage ]</h1 >
 [percentage for(var i=0;   i<supplies.length;  I add) {console.log(supplies[i])} percentage]
 < p>[ percentage = supplies percentage ]</p >

Please note here that there is an empty space after the lower console.log(supplies[i])}. When running at this time, the console of the browser will report an error:

图片描述

It’s very strange. I hope all the great gods on the internet can help me. thank you very much ~

Isn’t the output supposed to be like this?

< p>[ percentage = supplies[i] percentage ]</p >