let body = { nfsmount: this.mountNfsMount, mandatory: false, isdirectory:…
- User
let body = { nfs_mount: this.mountNfsMount, mandatory: false, is_directory: this.mountIsDirectory, readonly: this.mountReadOnly, }; this.data.kube.mounts[this.mountName] = body;
Adding this.mountName property doesn't work when the data.kube.mounts object is empty. Why?
- Assistant
In JavaScript, if you're trying to add a property to an object that is located within another object, but the parent object doesn't exist, you'll run into a
TypeError. The error occurs because you are trying to assign a property toundefined, and this action cannot be done.Here's a breakdown of the situation based on your snippet:
- should be an object.