Question: I have the following array of objects:

```
 [
      {status: 3, name: Joe},
      {status: 3, name: John}, 
      {status: 2, name: Lucas}, 
      {status: 1, name: Jeremiah}, 
      {status: 1, name: Steven}
    ]

```

I would like to find and replace all objects where status is equal to 1 with the number 2 so that the resulting array would be in the same order: 

```
[
      {status: 3, name: Joe},
      {status: 3, name: John}, 
      {status: 2, name: Lucas}, 
      {status: 2, name: Jeremiah}, 
      {status: 2, name: Steven}
 ]

```

This array could potentially be any length from 1 to around 10,000 so I would like to find a memory-efficient approach to this scenario.

Any help is well appreciated.

Answer: 
It depends on your use case.

One reason could be that you're having an already deployed app in production. You may want to only add Vue.js to some parts of the app. You may even have multiple vue instances on the same page, so saving a reference to them makes sense.

Another reason is to use a global event bus. When implementing this you'll save a reference to a new Vue component. Similar to this:

`Vue.prototype.$eventBus = new Vue();`
I think I got a use case. And I think it clarifies my question as well. 

Note that we can't use arrow functions on an options property or callback, such as `created: () => console.log(this.a)` or `vm.$watch('a', newValue => this.myMethod())`. 
Since an arrow function doesn’t have a `this`, `this` will be treated as any other variable and lexically looked up through parent scopes until found, often resulting in errors such as 
`Uncaught TypeError: Cannot read property of undefined or Uncaught TypeError: this.myMethod is not a function.`

But, if we use an arrow function with the data property, this won’t be the component’s instance, but we can still access the instance as the function’s first argument: 

```
var data = { a: 1 }

// direct instance creation
var vm = new Vue({
  data: data
})
vm.a // => 1
vm.$data === data // => true

// must use function when in Vue.extend()
var Component = Vue.extend({
  data: vm => ({ a: vm.myProp })
})

```

But this is not the common practice. We usually declare data property in components as functions so that we can directly access the vue instance.

```
// must use function when in Vue.extend()
var Component = Vue.extend({
  data: function () {
    return { a: 1 }
  }
})

```