How ‘this’ keyword work on javascript objects?

why the keyword 'this' can access tasks which is not in the same object ?

 anyobject = {
  template: '#task-list',
  props: {
    tasks: {default: []}
  },
  data() {
    return {
      newTask: ''
    };
  },
  computed: {
    incomplete() {
      return this.tasks.length; // I DONT UNDERSTAND HOW THIS WORKS HERE 
    }
  },


Read more here: https://stackoverflow.com/questions/68459499/how-this-keyword-work-on-javascript-objects

Content Attribution

This content was originally published by akmal hazim at Recent Questions - Stack Overflow, and is syndicated here via their RSS feed. You can read the original post over there.

%d bloggers like this: