I am pretty new to frontend development, currently learning Vue.js. When I follow its tutorial, there is one paragraph that says:
This looks pretty similar to just rendering a template, but Vue.js has done a lot of work under the hood. The data and the DOM are now linked, and everything is now reactive. How do we know? Just open up your browser developer console and modify exampleData.name. You should see the rendered example above update accordingly.
<!-- this is our View -->
<div id="example-1">
Hello {{ name }}!
</div>
// this is our Model
var exampleData = {
name: 'Vue.js'
}
// create a Vue instance, or, a "ViewModel"
// which links the View and the Model
var exampleVM = new Vue({
el: '#example-1',
data: exampleData
})
In the console, instead of modifying exampleData.name I give exampleData another object like exampleData = {}
. Now, the reference has been modified to point to elsewhere, and it seems there is no reference to the original data(exampleData.name
), I wonder if this is a memory leak? If not, what kind of situation is a true memory leak?