Skip to content

Instantly share code, notes, and snippets.

@sevperez
Created July 8, 2018 21:35
Show Gist options
  • Save sevperez/138f3b0d43b81a8502f8ccf612d812c3 to your computer and use it in GitHub Desktop.
Save sevperez/138f3b0d43b81a8502f8ccf612d812c3 to your computer and use it in GitHub Desktop.
var prices = [400, 80, 375, 870];
var products = {
"widget": 400,
"gear": 80,
"crank": 375,
"lever": 870,
};
var pricesDescriptors = Object.getOwnPropertyDescriptors(prices);
console.log(pricesDescriptors);
// logs:
// { 0: {value: 400, writable: true, enumerable: true, configurable: true},
// 1: {value: 80, writable: true, enumerable: true, configurable: true},
// 2: {value: 375, writable: true, enumerable: true, configurable: true},
// 3: {value: 870, writable: true, enumerable: true, configurable: true},
// length: {value: 4, writable: true, enumerable: false, configurable: false} }
var productsDescriptors = Object.getOwnPropertyDescriptors(products);
console.log(productsDescriptors);
// logs:
// { crank: {value: 375, writable: true, enumerable: true, configurable: true},
// gear: {value: 80, writable: true, enumerable: true, configurable: true},
// lever: {value: 870, writable: true, enumerable: true, configurable: true},
// crank: {value: 375, writable: true, enumerable: true, configurable: true} }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment