Mar 20, 2024
Already the 2nd example fails by throwing TypeError: 'Object.defineProperty called on non-object' due to having omitted the first parameter, the object itself, where one wants to add the later to be detected 'data' entry to. And of cause the expected output should be 'Key Not Found 404' instead of what the comment states ... 'This will output Key Found'.
At the author, please do an entire and very careful proof reading and example-code testing before pasting such code. Newcomers will be left confused with malfunctioning code and most probably will not trust other articles of yours.