Search code examples
javascriptnode.jssublimetext3build-system

JS in Sublime Text 3 with Node.js Build system


I'm executing JS code in sublime text 3 with Node 9.4.0 as build system. I would like to know why when I run:

function Person () {     }

var manu = new Person();

console.log(Person.prototype)

I get:

Person {}

But when I run it from Chrome console, I get:

{constructor: ƒ}
  constructor: ƒ Person()
  __proto__: Object

How can I get Node to display the content of Person.prototype ?

Why does it display it empty?

Thanks for your answers.


Solution

  • According to another question/answer, it looks like you could do something like

    console.log(Object.getOwnPropertyNames(Person.prototype))