Experience-Monks / Experience-Monks/devtool

Devtool Chrome debugger cannot find prototype closure functions

Open
#110 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
3.7k
Forks
147
PR merge metrics
No merged PRs in 30d

Description

Have tried this several ways. Finally I took an example directly from MDN on this link here:
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Closures

The text below is in a file called index.js (which i call from the cmd line with "devtools index.js --break")

var mo = new MyObject("me","hello");

mo.getName(); // mo should work but function getName is undefined in the debugger

function MyObject(name, message) {
this.name = name.toString();
this.message = message.toString();
}
(function() {
this.getName = function() {
return this.name;
};
this.getMessage = function() {
return this.message;
};
}).call(MyObject.prototype);

Chrome debugger loads fine and i can step through the program but my prototype chain does not connect to the correct prototype.

This also fails with

Function MyObject () {

}
MyObject.prototype = {
getName : function(){ }
...
}

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.