A writable computed in Vue
Vue interview exercise on Computed & watchers, difficulty 2 of 3. Solve it in the editor beside a worked example, or cold in Interview mode with the example hidden; 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. Interview mode hides the example: solve it from memory, without the hint or the solution, and it counts as solved cold. Progress is saved in your browser, and in your account if you sign in.