I'm new with JS and I have the next doubt. It's possible to use destructuring with HTML to get attributes? Actually I know this way.
var foo = document.getElementById('script1');
var bar = foo.getAttribute('var1');
var any = foo.getAttribute('var2');
<script id="script1" src="code.js" var1="var1" var2="var2">
</script>
In my understanding, the way to use object destructuring is:
{ var 1, var2 } = foo;
But actually I'm getting undefined values.