Form buttons in JavaScript

You already know that a form is submitted when a button is clicked. Here, however, there are nuances. The button must have the type attribute set to submit:

public/form.html<form>
  <input name="test1">
  <input name="test2">
  <input type="submit">
</form>

A form will also be submitted by the button tag with the type attribute set to submit:

public/form.html<form>
  <input name="test1">
  <input name="test2">
  <button type="submit">btn</button>
</form>

A form will also be submitted if you put focus in any of the inputs and press Enter.

The button with the type attribute set to button is used as a page element and will not submit a form:

public/form.html<form>
  <input name="test1">
  <input name="test2">
  <input type="button">
</form>

The button tag will work in the same way:

public/form.html<form>
  <input name="test1">
  <input name="test2">
  <button>btn</button>
</form>

Button with the type attribute set to reset will clear a completed form:

public/form.html<form>
  <input name="test1">
  <input name="test2">
  <input type="reset">
  <input type="submit">
</form>
Задание 1

Correct the following code so that a button submits a form to the server:

html<form>
  <input name="name">
  <input name="surn">
  <button>submit</button>
</form>