re: Typical JavaScript interview exercises (explained) VIEW POST

FULL DISCUSSION
 

I've been writing for about a decade now, but didn't know about that it is possible to bind functions to objects like this:

let dog = {
   sayName () {
    console.log(this.name)
  }
}

Is this a relatively new thing or it has always worked like this? Are there any reference material on this?

code of conduct - report abuse