Skip to content

Instantly share code, notes, and snippets.

View blarfoon's full-sized avatar
💻
Coding

Davide blarfoon

💻
Coding
View GitHub Profile

Contribution License Agreement

Thank you for your interest in contributing to open source software projects (“Projects“) made available by Davide Ceschia or his affiliate.

This Contribution License Agreement (“Agreement”) is agreed to by the party signing below (“You”), sets out the terms governing any source code, object code, bug fixes, configuration changes, tools, specifications, documentation, data, materials, feedback, information or other works of authorship that you submit or have submitted to Davide Ceschia and/or its affiliates (“Davide Ceschia”) for Your contributions to Davide Ceschia open source Projects.

This Agreement is effective as of the latest signature date below, and you agree that the following terms apply to all your past, present and future Submissions.

const myFirstObject = {
hi: "mom",
sayHi() {
console.log("hi " + this.hi);
},
};
const mySecondObject = Object.create(myFirstObject);
mySecondObject.hi = "medium";
const myFirstObject = {
hi: "mom",
};
const mySecondObject = Object.create(myFirstObject);
console.log(mySecondObject.hi, mySecondObject.hasOwnProperty("hi")); // > mom false
function myObjectFunc() {
this.hi = "mom";
}
const myObject = Object.create(myObjectFunc.prototype)
myObjectFunc.call(myObject)
// This will not work as intended!
myObjectFunc.hello = "world";
console.log(myObject); // undefined!
const myObject = {};
console.log(myObject.toString())
// in this case it's the same as calling
console.log(Object.getPrototypeOf(myObject).toString())
function myObjectFunc() {
this.hi = "mom";
}
const myObject = new myObjectFunc();
// This will not work as intended!
myObjectFunc.hello = "world";
console.log(myObject.hello); // undefined!
const myArray = [1, 2, 3];
Object.defineProperty(myArray, "hi", {
value: "mom",
});
myArray.hello = "world";
console.log(myArray);
for (const key in myArray) {
console.log("key:", key);
const myObject = {
hi: "mom",
};
console.log(myObject.hasOwnProperty("hi")); // > true
let result = Reflect.deleteProperty(myObject, "hi");
console.log(result, myObject.hasOwnProperty("hi")); // > true false
// PAY ATTENTION NOW
const myObject = {
hi: "mom",
};
console.log(myObject.hasOwnProperty("hi")); // > true
delete myObject.hi;
console.log(myObject.hasOwnProperty("hi")); // > false
// PAY ATTENTION NOW
const myObject = {};
Object.defineProperty(myObject, "hi", {
value: "mom",
writable: true, // default: false
enumerable: true, // default: false
configurable: true, // default: false
});
console.log(myObject.hi); // > mom