So to use the for/in loop to iterate through the object let's use our product object again.
var product = new Object();product.name = "Chai";product.category = "Tea";product.country = "India";product.supplier = {name: "ACME Tea Of India",location: "New Delhi"};
Now type in the following to loop through the object with the for/in loop and outputs the property name and property value to the console
for (prop in product)console.log(prop + ": " + product[prop]);
As you can see we only got through the first level of the properties, since supplier is nested object how do we get the properties for it? You would think it's as easy as changing the code to have nested for/in loop would do the trick.
Like this
for(prop in product)
{
console.log(prop + ": " + product[prop]);
for(p in prop)
console.log(p + ": " + prop[p]);
}
But as you can see that's not the case, instead you get the characters of the property names. As you can see the supplier property is actually an object itself.
Thank you so much for sharing this thread with us, It's a good post..keep posting and updating the more information like this. By the way, I am a professional javascript academic writer and provide Assignment help services to the students in Australia.
ReplyDelete
ReplyDeleteThis is a nice article for sharing great information. Thank you for providing such a wonderful and educative update. I would appreciate it if you could keep sharing.- what is skyline university cut off mark
pgslot มาแรง ไม่แพ้ ลิเวอร์พูล เพราะเว็บของเรานั้นก็กำลัง ขับเคลื่อนเปรียบเสมือนเครื่องจักรที่กำลังมาแรงที่สุดเพราะเว็บ pg-slot.game ของเรานั้นกำลังนำเสนอเกมให้ทุกท่านที่เข้ามาได้รู้จัก
ReplyDeleteThanks for sharing informative post. Digital Marketing Institute in Jammu where you can explore many thing about digital marketing.
ReplyDeleteสล็อต ไม่มี ขั้น ต่ำ แน่ๆว่าจุดเด่นของกิจกรรมนี้เป็นพวกเราไม่ต้องฝากเงินก่อน PG SLOT แม้กระนั้นก็ยังมีเครดิตสูงซึ่งพอเพียงต่อการพนันได้ทุกชนิด แล้วทางเว็บ สล็อต เติมวอเลท
ReplyDeleteslot games สมาชิกใหม่ ต้นแบบ การพนันสามมิติที่ช่วยเปิดมิติใหม่ของการเล่นสล็อต แกล้งมีประสบการณ์การเล่นสล็อตที่ละเอียด ล้ำยุค พร้อมเอฟเฟกต์เสียงสุดตื่นเต้นแล้วก็แอนิเมชั่น PGSLOT
ReplyDeleteI appreciate your efforts for posting this article.Discover the ultimate collection of fFree Android Apk Mod Download for all your favorite apps and games. Get unlimited resources, unlock exclusive features, and enjoy an enhanced gaming or app experience. https://www.apkroute.com/
ReplyDeleteThanks for sharing such a wonderful and informative post python course fees in hyderabad We can explore and learn more about It professional courses online
ReplyDeletethank you sharing valuable information
ReplyDeleteHere is sharing Business Analytics with Excel Training Information may be helpful to you
Business Analytics with Excel
"Thank you for taking the time to express your appreciation for my blog. Your support fuels my creativity and encourages me to explore new topics. I'm so grateful for readers like you who make this journey worthwhile!" For more information visit us on Clinical Research Courses in pune
ReplyDelete"عطر الزعفران
ReplyDelete"
"/a>
باقة من الورود
ReplyDeleteمنتجات الـمساج
ReplyDeleteنسايم العود
ReplyDeleteحناء بركات
ReplyDeleteدليلك للدروب شوبينق
ReplyDeleteمتجر منى ستايل للملابس النسائيه
ReplyDeleteطبعا طبيعي متجر سناكات صحية
ReplyDeleteتمر مجدول
ReplyDeleteلايت بوكس إيتاتشي
ReplyDeleteمنتجات عناية بالبشرة
ReplyDeleteالكرياتين
ReplyDeleteمشروع عن المواطنة الرقمية
ReplyDeleteبديل الخشب
ReplyDeleteعطر سترونجر وذ يو رجالي
ReplyDeleteلوازم الرحلات والتخييم
ReplyDeleteمناديل سحب
ReplyDeleteساعات ذكية سبارك
ReplyDeleteالعناية بالبشرة
ReplyDeleteخلطة عسل للرجال
ReplyDeleteسلاسل فضة
ReplyDeleteساعات ذكية
ReplyDeleteسلسال مربع زركون ناعم
ReplyDeleteعبايات سوداء فخمة
ReplyDeleteنعيمي كشميري
ReplyDeleteشمع
ReplyDeleteOUI PERFUME
ReplyDeleteنظارة شانيل
ReplyDeleteاكاديمية سكاي للطيران
ReplyDeleteThis comment has been removed by the author.
ReplyDeleteThe charm of the East with the simplicity of Western design, we collect in one place, silver jewelry, gold designs, diamonds, precious stones made of precious natural stones in Saudi Arabia.
ReplyDeleteمجوهرات نسائية
قلادات نسائية
شوكر
الاطقم
Join the Amad platform, the first destination for contracting projects and services in Saudi Arabia. We provide innovative and reliable solutions for all your construction, renovation and professional services needs. We can turn your vision into reality
ReplyDeleteمشاريع المقاولات
انواع الارضيات
التحول الرقمي
خدمات الصيانة
Banoon Children's Toys Store. Enjoy a unique shopping experience and enjoy a wide variety of educational and entertaining toys for children at excellent prices.
ReplyDeleteألعاب تعليمية
ألعاب تحدي
ألعاب ترفيهية للأولاد
العاب ترفيهيه للبنات