#javascript reduce is messed up
8 messages · Page 1 of 1 (latest)
Once your ticket has been resolved, please close it with </ticket close:1054771505520717835> command!
let v = inventory.findAll().reduce((a,b) => a+b==null?0:b.nbt==null?1:b.nbt.value,0)
with inventory being a ModifyRecipeCraftingGrid type
var v = 0
for (var n of inventory.findAll()) {
v += n==null?0:n.nbt==null?1:n.nbt.value
}
i also made this for loop version that works fine but looks less cool
and here's the whole error message (tldr: out of bounds 1 for array size 1)
Paste version of message.txt from @minor solstice