Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

7
  • 1
    It's a wonderful new world we live in. I continue to be impressed that after all these years people are still responding to my initial post. 😃 Commented Oct 6, 2021 at 12:07
  • 1
    amazing bro, but, how about set new value, can you? Commented Feb 8, 2022 at 7:07
  • Could definitely use a "set", but my brain breaks trying to figure it out. Commented Mar 4, 2022 at 20:20
  • 1
    the set function is non-trivial, consider set(obj, "a", 1) followed by set(obj, "a.b", 2). the second call attempts to access the b property on a, but a has been set to a non-object (number). matters complicate when you consider objects may contain arrays, which may contain objects, which may contain arrays. Commented Sep 16, 2023 at 2:04
  • 1
    For those interested, I updated the post with two set function examples Commented Sep 16, 2023 at 3:22