Javascript for loop causes error – maybe technique wrong?

For introduction: https://mytechservinginternetmeals.blogspot.com/2021/10/how-to-start-making-browser-video-game.html

Could anyone tell how to fix the error in code that try’s to check errors in it?

THIS CAUSES TypeError: Cannot read properties of undefined (reading ‘resourcePath’)

const novietojumi = [
  "0.1221 0.1221",
  "0.1111 0.1111",
  "0.1111 0.1111",
  "0.1111 0.1111",
  "0.1111 0.1111",
  "0.1111 0.1111",
  "0.1111 0.1111",
  "0.1111 0.1111",
];
let arrayLength = novietojumi.length;

console.log(arrayLength);

for (let i = 0, x = 0, y = 0; i < arrayLength; i++, y++, x++) {
  //console.log(novietojumi[i]);

  const NOV = novietojumi[i].split(" ");
  console.log(NOV);
  console.log("KOORD1", NOV[0]);
  console.log("KOORD2", NOV[1]);
  _P.set(NOV[0], 0.0, NOV[1]);
  _P.add(center);
  _P.multiplyScalar(50.0);

  const key = '__scenery__[' + _P.x + '][' + _P.z + ']';
  if (this.FindEntity(key)) {
    //continue;
  }

  _V.copy(_P);

  _P.x += (this.noise_.Get(_P.x, 0.0, _P.z) * 2.0 - 1.0) * 25.0;
  _P.z += (this.noise_.Get(_P.x, 1.0, _P.z) * 2.0 - 1.0) * 25.0;
  _P.y = terrain.GetHeight(_P)[0];

  const biome = this.FindBiome_(terrain, _P);

  const roll = this.noise_.Get(_V.x, 2.0, _V.z);
  if (roll > _BIOMES[biome]) {
    //continue;
  }

  const e = this.SpawnAt_(biome, _P);

  //console.log(e);
  e.SetPosition(_P);

  //console.log(e, key);
  this.Manager.Add(e, key);

  e.SetActive(false);
  this.crap_.push(e);
}

THIS DOES NOT:

for (let x = -10; x <= 10; ++x) {
  for (let y = -10; y <= 10; ++y) {
    _P.set(x, 0.0, y);
    _P.add(center);
    _P.multiplyScalar(50.0);

    const key = '__scenery__[' + _P.x + '][' + _P.z + ']';
    if (this.FindEntity(key)) {
      continue;
    }

    _V.copy(_P);

    _P.x += (this.noise_.Get(_P.x, 0.0, _P.z) * 2.0 - 1.0) * 25.0;
    _P.z += (this.noise_.Get(_P.x, 1.0, _P.z) * 2.0 - 1.0) * 25.0;
    _P.y = terrain.GetHeight(_P)[0];

    const biome = this.FindBiome_(terrain, _P);

    const roll = this.noise_.Get(_V.x, 2.0, _V.z);
    if (roll > _BIOMES[biome]) {
      //continue;
    }

    const e = this.SpawnAt_(biome, _P);

    e.SetPosition(_P);

    this.Manager.Add(e, key);

    e.SetActive(false);
    this.crap_.push(e);
  }
}

THIS CODE sample is where error gets found :

const _SCENERY = {
  birch1: {
    base: 'Birch_1.fbx',
    resourcePath: './resources/trees/FBX/',
    names: {
      Bark: 'Birch_Bark.png',
      Leaves: 'Birch_Leaves_Yellow.png'
    },
    scale: 0.075,
    biomes: ['forest'],
    collision: true,
  },
  tree1: {
    base: 'Tree_1.fbx',
    resourcePath: './resources/trees/FBX/',
    names: {
      Bark: 'Tree_Bark.jpg',
      Leaves: 'Leaves_Blue.png'
    },
    scale: 0.1,
    biomes: ['forest'],
    collision: true,
  },
  rock1: {
    base: 'Rock_1.fbx',
    resourcePath: './resources/nature/FBX/',
    names: {},
    scale: 0.025,
    biomes: ['arid', 'desert'],
  },
  rockMoss1: {
    base: 'Rock_Moss_1.fbx',
    resourcePath: './resources/nature/FBX/',
    names: {},
    scale: 0.025,
    biomes: ['forest'],
  },
  plant1: {
    base: 'Plant_1.fbx',
    resourcePath: './resources/nature/FBX/',
    names: {},
    scale: 0.05,
    biomes: ['forest', 'arid'],
  },
  grass1: {
    base: 'Grass_1.fbx',
    resourcePath: './resources/nature/FBX/',
    names: {},
    scale: 0.05,
    biomes: ['forest', 'arid'],
  },
  flowers1: {
    base: 'Flowers.fbx',
    resourcePath: './resources/nature/FBX/',
    names: {},
    scale: 0.05,
    biomes: ['forest'],
  },
};

const _BIOMES = {
  desert: 0.1,
  forest: 0.8,
  arid: 0.6,
};

const multiples = {
  birch1: {
    name: 'Birch_',
    key: 'birch',
    num: 10
  },
  tree1: {
    name: 'Tree_',
    key: 'tree',
    num: 10
  },
  rock1: {
    name: 'Rock_',
    key: 'rock',
    num: 7
  },
  rockMoss1: {
    name: 'Rock_Moss_',
    key: 'rockMoss',
    num: 7
  },
  plant1: {
    name: 'Plant_',
    key: 'plant',
    num: 5
  },
  grass1: {
    name: 'Grass_',
    key: 'grass',
    num: 2
  },
};


SpawnAt_(biome, spawnPos) {
  const matchingScenery = [];
  for (let k in _SCENERY) {
    if (_SCENERY[k].biomes.indexOf(biome) >= 0) {
      matchingScenery.push(k);
    }
  }

  const roll = this.noise_.Get(spawnPos.x, 3.0, spawnPos.z);
  const randomProp = _SCENERY[
    matchingScenery[Math.round(roll * (matchingScenery.length - 1))]];

  const e = new entity.Entity();
  e.AddComponent(new render_component.RenderComponent({
    scene: this.params_.scene,
    resourcePath: randomProp.resourcePath,
    resourceName: randomProp.base,
    textures: {
      resourcePath: './resources/trees/Textures/',
      names: randomProp.names,
      wrap: true,
    },
    emissive: new THREE.Color(0x000000),
    specular: new THREE.Color(0x000000),
    scale: randomProp.scale * (0.8 + this.noise_.Get(spawnPos.x, 4.0, spawnPos.z) * 0.4),
    castShadow: true,
    receiveShadow: true,
    onMaterial: (m) => {
      if (m.name.search('Leaves') >= 0) {
        m.alphaTest = 0.5;
      }
    }
  }));

  if (randomProp.collision) {
    console.log("e");
    e.AddComponent(
      new spatial_grid_controller.SpatialGridController({
        grid: this.params_.grid
      }));
  }

  const q = new THREE.Quaternion().setFromAxisAngle(
    new THREE.Vector3(0, 1, 0), this.noise_.Get(spawnPos.x, 5.0, spawnPos.z) * 360);
  e.SetQuaternion(q);

  return e;
}