Question 30
Consider the following application with markup “index.html” and javascript file “app.js”, and answer the given subquestions.
index.html:
<body> <div id="app"> <div id="sort"> <li v-for="slot in recent">{{slot.date.getDate()}}</li> </div> <div id="status"> <li v-for="slot in booked">{{slot.id}}</li> </div> </div> <script src="https://cdn.jsdelivr.net/npm/vue@2/dist/vue.js"></script> <script src="app.js"></script></body>app.js :
new Vue({ el: '#app', data: { slots: [ { id: 1, date: new Date('December 19'), status: false }, { id: 2, date: new Date('December 17'), status: true }, ], }, computed: { recent() { return this.slots.sort((a, b) => { return b.date - a.date }) }, booked() { return this.slots.filter((slot) => { return slot.status }) }, },})1
21
2
None of these