[Vuejs]-Correct this value using find() in Vue.js

0πŸ‘

βœ…

As it is written, your function is not bound to any specific context, so this will refer to the window object, which is the top-most context.

You should use Function.prototype.bind to make your function bound to your specific context.

console.log(this.titles.find(this.findStart.bind(this)));

0πŸ‘

β€œthis” inside the function own only the code within that function so i assume you want to call the room variable but before that you have to bind β€œthis” with the
object that owns the room object

Leave a comment