A
A
Alexey Shchepetkin2019-10-22 16:39:32
JavaScript
Alexey Shchepetkin, 2019-10-22 16:39:32

I can not understand why this line of code is used in vue.js?

I am analyzing form validation in view, and in the example ( https://codepen.io/cfjedimaster/pen/vWqNXZ) I don’t understand the logic of what is happening. Namely line 11 this.errors = []; .We declared an array in the data, why can't we just refer to it and immediately push this.errors.push into it . Why re-advertise? Thanks in advance...
5daf0683d71aa900365262.png

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Andrew, 2019-10-22
@schepetkin

It's not an announcement, it's a reset.
So that it was initially 0, then it will be filled if errors appear, i.e. so that previous errors do not display

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question