+ 1

How to get value from the same object in javascript

This is the code https://code.sololearn.com/Wl00OOzCxe0H/?ref=app

27th Feb 2022, 3:33 AM
EsaKurniawan
1 Answer
+ 2
EsaKurniawan What you are trying to get didn't get but that is not the right way. You have to do like this: window.onload = function () { var el = document.createElement("input"); el.value = "abc"; document.body.appendChild(el); let obj = {}; obj.el = el; obj.value = el.value; let arr = []; arr.push(obj); console.log(arr[0].value); }
27th Feb 2022, 4:29 AM
A͢J
A͢J - avatar