A writable computed in Vue
Vue interview exercise on Computed & watchers, difficulty 2 of 3. Solve it in the editor beside a worked example; the tests run the moment you do.
Write FullName: inputs <input class="first"> and <input class="last"> bound to two refs, an <input class="full"> bound to a writable computed `fullName` (first and last joined by a space, trimmed), and <p> showing the full name. Typing into the full input splits on the first space: the first word becomes the first name, the rest the last name (empty when there is no space).
Each exercise pairs a worked example with a twin problem to solve in a real editor; the tests run the moment you do. Progress is saved in your browser, and in your account if you sign in.