flâneur — a map of the web's best reading

Objects in Depth

learn.udacity.com · 60 words · saved by 1 readers

Previously, we saw that the properties and methods contained inside an object belong to that object. Let's drive this home with one quick example: We've already looked at how this inside a method refers to the object that the method was called on. Let's take a closer look at chameleon's lookAround() method. Inside the function body is the code this.eyes. Since the lookAround() method was called on the chameleon object as chameleon.lookAround();, the value of this is the chameleon object itself! As such, this.eyes is the number 2, since it refers to the value of the chameleon object's eyes property. Now, let's check out a different example. What do you think will be the value of this inside the following code? Write your thoughts below. true Thank you for your thoughts! Let's compare the code from the chameleon object with the whoThis() code. Before we dive into how this all works, take a look at the use of this inside both of these code snippets: There is some other code around them, b

Sign In - Udacity إنشاء حساب تسجيل الدخول تسجيل الدخول إلى حسابك. ابنِ مهارات اليوم والغد وما بعده. تعليم يؤمن مستقبلك المهني. تسجيل الدخول عبر جوجل تسجيل الدخول عبر فيسبوك أو تسجيل الدخول باستخدام مؤسستك. أو عنوان البريد الإلكتروني كلمة المرور بالنقر على "تسجيل الدخول"، فإنك توافق على شروط الاستخدام و سياسة الخصوصية الخاصة بنا. Loading... هل نسيت كلمة المرور؟

Explore this link on the map →

related reading