Last active
May 29, 2018 02:22
-
-
Save completejavascript/17648921b616dc89ab21f20672793d76 to your computer and use it in GitHub Desktop.
Fun quiz!!
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let foo = function bar() { | |
return "hello"; | |
} | |
console.log(typeof bar); | |
// What will console print? | |
// Ref: Named function expression | |
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/function |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let person = { | |
name: "foo" | |
}; | |
Object.preventExtensions(person); | |
person.name = "bar"; | |
person.job = "teacher"; | |
console.log(person); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let person = { | |
name: "foo" | |
}; | |
Object.preventExtensions(person); | |
person.__proto__ = { job: "teacher" }; | |
console.log(person.job); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let person = { | |
name: "foo" | |
}; | |
Object.preventExtensions(person); | |
person.__proto__.sayHi = function() { | |
console.log("Hi"); | |
} | |
console.log(person.sayHi()); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let a = { x : 1, y : 2 }; | |
let b = { y : 3, z : 4 }; | |
Object.assign(a, b); | |
console.log(a, b); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let a = Object.create({ foo: 1 }, { | |
bar: { value: 2 }, | |
baz: { value: 3, enumerable: true } | |
}); | |
let b = Object.assign({}, a); | |
console.log(b); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment