Skip to content

Instantly share code, notes, and snippets.

@moiz-frost
Created September 3, 2019 10:11
Show Gist options
  • Save moiz-frost/20a455172ce05094350ce2ecb024bc61 to your computer and use it in GitHub Desktop.
Save moiz-frost/20a455172ce05094350ce2ecb024bc61 to your computer and use it in GitHub Desktop.
Creating an object using object.create()
var car = Object.create(Object.prototype, {
year: {
value: '2010',
writable: true,
enumerable: true,
configurable: true },
make: {
value: 'Honda',
writable: true,
enumerable: true,
configurable: true },
color: {
value: 'White',
writable: true,
enumerable: true,
configurable: true },
transmission:{
value: 'Manual',
writable: true,
enumerable: true,
configurable: true },
horsePower: {
value: 140,
writable: true,
enumerable: true,
configurable: true },
topSpeed: {
value: 120,
writable: true,
enumerable: true,
configurable: true
}
}
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment