We were unable to load Disqus. If you are a moderator please see our troubleshooting guide.

whip • 1 year ago

good helpfull

Letty • 1 year ago

thanks very much, this article explains very clearly!

Miles Williams • 1 year ago

console.log(ownerName + ", this is your car: " + this.registrationNumber + " " + this.brand);
How about...
console.log(`${ownerName}, this is your car: ${this.registrationNumber} ${this.brand});
Please use backticks and expression interpolation and not concatenation.
For a solid style guide I like to refer to https://github.com/airbnb/javascript

smrakib24 • 6 months ago

In the beginning of this article on first point of 'Basic rules worth remembering:' section stated that the value of ''this'' is always an object. I am sorry to say that this is not true. Spouse we pass 1 as argument on bind function which associated with certain function invocation. Then the value of ''this '' is
one. We can set any type of data as ''this''. I attached a small code here.

let x = {
i: function() {
return this

let a = x.i.bind(1);
let b = x.i.bind(x);

console.log(a()) // 1
console.log(b()) // { i: function() { return this }}