I am teaching myself to use prototypes to extend the functionality of objects. I have hit a roadblock when it comes to functions though, when I log a function to string it returns something I don't understand. For example, given:
function foo() {
var a = 1
var b = 2
return a + b
}
console.log( foo.toString() )
you get:
`function foo() {
var $_$c = $_$wf(1);
var a = ($_$w(1, 130, $_$c), 1);
var b = ($_$w(1, 131, $_$c), 2);
return $_$w(1, 132, $_$c), a + b;
}`
I would expect to get:
`function foo() {
var a = 1
var b = 2
return a + b
}`
Why?
try this:
When you print 'x' it should give you the code as a string too.