- <!DOCTYPE html>
- <html>
- <head>
- <meta name="viewport" content="width=device-width, initial-scale=1">
- </head>
- <body>
- <input type="button" value="for of object" onclick="read_objects();">
- <script>
- function read_objects()
- {
- var ar_ob = [];
- var obj = new Object()
- obj.name = 'merbin';
- obj.mark = 56;
- ar_ob.push(obj);
- var obj = new Object()
- obj.name = 'Franklin';
- obj.mark = 98;
- ar_ob.push(obj);
- var obj = new Object()
- obj.name = 'Ramesh';
- obj.mark = 93;
- ar_ob.push(obj);
- for (i of ar_ob)
- {
- debugger;
- alert("Name : " + i.name);
- alert("Mark : " + i.mark);
- }
- }
- </script>
- </body>
- </html>
Read object using for- of :- genius student
Reviewed by Network security
on
October 18, 2019
Rating:
No comments: