Weird behaviour in Wick editor

Complete the following questions so forum users and Wick Editor developers can give you the best help possible! If the following questions are not completed, your post may be edited or removed.

Has this bug been reported already?

Describe the bug

let c = [{"placeHolder":"storing","tagName":"K24Storing"},{"placeHolder":"start","tagName":"K24Start"}];
for (let idx in c){

Console output:

To Reproduce
Run the code in Wick editor script engine. Note that the Wick runtime somehow creates a 3rd element “max” in the array that should have 2 elements in it.

Expected behavior
Console output:

(this is confirmed by trying this code in the Try-it editor of W3Schools)

*Computer Information

  • OS: WIn 10
  • Device Type: Laptop
  • Browser: Chrome

Do you have a suggested solution to this issue? (ex. has another program fixed this bug a certain way? Are you familiar with where in the code base someone would need to fix this issue?)
Work around: use “normal” for loop.

pretty weird as c.length is 2

Forgot to mention that, but yes, you’re right, it’s 2!

This is probably a side effect of one of the libraries Wick Editor uses. And besides it’s generally a bad idea to use a for ... in loop to iterate through an array. You should use a normal for loop or a for ... of loop.

Thanks ph,
Using a normal for loop now.