123456789101112131415161718192021222324 |
- <head>read array of objects</head>
- <body>
- <script>
- const readArrayOfObjects = () => {
- const arr = [];
- do {
- let obj = null;
- while ((key = prompt("Enter obj property name")) &&
- (val = prompt("Enter obj property value"))) {
- if (!obj)
- obj = {};
- obj[key] = val;
- }
- if (obj)
- arr.push(obj);
- }
- while (confirm("continue&&???..."))
- return arr;
- }
- console.log(readArrayOfObjects());
- </script>
- </body>
|