Skip to content

Instantly share code, notes, and snippets.

@anttikuuskoski
Last active August 11, 2023 13:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anttikuuskoski/08c246aba218d74f65c752d55f836dae to your computer and use it in GitHub Desktop.
Save anttikuuskoski/08c246aba218d74f65c752d55f836dae to your computer and use it in GitHub Desktop.
Code to demonstrate a bug in Object.create in Shelly gen 2 firmware version 1.0.0-beta6.
// Code to demonstrate a bug in Object.create in Shelly gen 2 firmware version 1.0.0-beta6 in a Shelly Plus Plug S
let original = {
key: 'value'
};
// Make a clone
let clone = Object.create(original);
// Should print the original object stringified and it does
console.log("", JSON.stringify(original)); // {"key":"value"}
// Should print an object equal to the original. !!! Does not, instead prints an empty object.
console.log("", JSON.stringify(clone)); // {}
// If clone was really empty, should not print anything. Instead,
// prints value (as expected if not for the previous fail). Note: no quotes!
console.log("", clone.key); // value
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment