Today we learned more about objects which went into symbols, this, and primitive conversion. Objects are really complex with all of the things they can do.
Objects by default can only either a string or a symbol type. Symbol has some advantages over string, it represents a unique identifier. It is created using symbol(). You can also give symbol a description for debugging purposes. Symbols with the same id are not equal they are guaranteed to be different.
“This” is a method, and methods are functions that are stored in object properties. Method allow objects to “act” like object.doSomething(). Methods can reference the object as “this”. The value of this is defined at run-time. “This” has no value until the function is called. When a function is called in the “method” syntax (object.method()), the value of this during the call is object.
The last topic of today was primitive conversion which was a little weird for me. It allows you to convert an object to a number, string, or default. Converting to string is for when operation expects a string like alert. When an operation expects a number you convert it to number. Default is used with number conversion, just in case an operator doesn’t know what to expect.<div class='sharedaddy sd-block sd-like jetpack-likes-widget-wrapper jetpack-likes-widget-unloaded' id='like-post-wrapper-155635758-210-5d0776f4a8062' data-src='https://widgets.wp.com/likes/#blog_id=155635758&post_id=210&origin=trilamanila.com&obj_id=155635758-210-5d0776f4a8062' data-name='like-post-frame-155635758-210-5d0776f4a8062'><h3 class="sd-title">Like this:</h3><div class='likes-widget-placeholder post-likes-widget-placeholder' style='height: 55px;'><span class='button'><span>Like</span></span> <span class="loading">Loading...</span></div><span class='sd-text-color'></span><a class='sd-link-color'></a></div>