Clone and edit this document
Runkit
Runkit
home page
user forum
new notebook
clone notebook
download notebook
support & documentation
log in
sign up
new notebook
help & feedback
clone this notebook
download this notebook
Sign In
Sign Up
RunKit + npm: jsdom
node v6.17.1
endpoint
share
tweet
var jsdom = require("jsdom") var window = jsdom.jsdom().defaultView; function testDescriptor (obj) { Object.defineProperty(obj, 'testVar', {enumerable: true, get: function () { return 'test'; }}); console.log('get' in Object.getOwnPropertyDescriptor(obj, 'testVar')); } testDescriptor(global); // true (as expected) testDescriptor(window); // false (not expected) testDescriptor({}); // true (as expected)
Created from: https://runkit.com/npm/jsdom
Loading…
no comments
sign in
to comment