Js code problem?

    const jcado = {};
                  jcado.arr = [];
                  line.rows.forEach((lineCell) => {
                    const jcados = {};
                    lineCell.forEach((cell) => {
                      if (cell.name.indexOf("") > 0) {
                        jcados[cell.name] = cell.content.replace("T", " ");
                      } else if (cell.content === "(null)") {
                        jcados[cell.name] = "-";
                      } else if (cell.content === "") {
                        jcados[cell.name] = "-";
                      } else {
                        jcados[cell.name] = cell.content;
                      }
                    });
                    console.log("jcados", jcados);
                    jcado.arr.push(jcados);
                    console.log("jcado", jcado);
                    console.log("jcado.arr", jcado.arr);

Why does the jcado print in this code, where arr is empty, but print jcado.arr contains content?

Mar.31,2022

because what is printed is not a snapshot of the object, but a reference to the object


Menu