O
O
OtomiVetra2021-07-02 15:16:08
JavaScript
OtomiVetra, 2021-07-02 15:16:08

How to properly destructurize an object?

please tell me how to properly destructurize the object

const elements = document.forms.myForm.elements;

const artist = elements.artist;
const song = elements.song;

console log(artist);
console log(song);

thanks in advance

Answer the question

In order to leave comments, you need to log in

4 answer(s)
A
Alexander, 2021-07-02
@Seasle

https://learn.javascript.ru/destructuring-assignme...

V
Vovash, 2021-07-02
@V0vash

const elements ={
artist: "Биба",
song: "Боба"
}


const { artist, song } = elements;

console.log(artist);
console.log(song);

P
ParaBellum577, 2021-07-02
@ParaBellum577

const {artist, song} = document.forms.myForm.elements;
console.log(artist);
console.log(song);

P
plushazavr, 2022-04-11
@plushazavr

const { elements } = document.forms.myForm;
const { artist, song } = elements
console.log(artist);
console log(song);

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question