Creating a variable sized object array

I'm trying to create and store an array of objects with lenght i that I get from the length of my object array from an SQL query to my databse and initilize it with '0' to modify and use down the line. This is the code I'm using in a function node:

// Creates an array object to determine down the line if each individual recipe is met for the non-binary devices
for (i = 0;i < msg.myRecipes.length; i++){
    msg.conditionMet[i] = 0;

return msg;

But I get the following error. This seemed like the easiest way to do it to me but I can't get it to work...

TypeError: Cannot set property '0' of undefined

before the for loop define conditional as an array.
msg.conditional = [];

There is a compact way of doing that in javascript now
msg.conditionMet = new Array( msg.myRecipes.length ).fill(0)