I came across this code in JS Novice to Ninja.
const form = document.getElementsByTagname('form')[0];
const [input,button] = form.elements;
this create a const called input mapped to the value of the form[0] and another const called button mapped to form[1]
is this:
const [input,button] = form.elements;
the same as:
const input = form.elements[0];
const button = form.elements[1];
Is that just some shorthand I've never come across? If so can someone tell me what it's called? Or am I misunderstanding what is happening here.