this
[object Window]
function MyObject(val) {
this.a = val;
this.b = 'test';
}
var obj = new MyObject(123);
obj
{ "a": 123, "b": "test" }
function example() {
return 'a = ' + this.a + ', b = ' + this.b;
}
example()
"a = undefined, b = undefined"
obj.toString = example;
obj.toString()
"a = 123, b = test"
'str: ' + obj
"str: a = 123, b = test"
The console allows you to interact with the course material and examples. Use the following keys:
A special logging function is also available: