{"id":319,"date":"2018-09-13T22:40:06","date_gmt":"2018-09-13T22:40:06","guid":{"rendered":"http:\/\/www.projectimmerse.com\/?p=319"},"modified":"2020-06-17T08:12:08","modified_gmt":"2020-06-17T08:12:08","slug":"javascript-fundamentals-part-2","status":"publish","type":"post","link":"https:\/\/www.projectimmerse.com\/blog\/javascript-fundamentals-part-2\/","title":{"rendered":"Javascript Fundamentals Part 2"},"content":{"rendered":"<p>Welcome to Javascript Fundamentals Part 2. Javascript is such an endless pit of code this will be somewhat of an infinite series of parts.<\/p>\n<p>To recap, I covered data types, loops, and a few conditional structures in part 1 of this series. I&#8217;ve decided to cover object method and properties &#8211; a few basic ones. <\/p>\n<p>You&#8217;ve probably heard this one before.<\/p>\n<p><!--more--><\/p>\n<blockquote>\n<p>Everything in Javascript is an object.<\/p>\n<\/blockquote>\n<p>Well this is true &#8211; except it gets really confusing because there are other types in Javascript. <\/p>\n<ul>\n<li>String<\/li>\n<li>Number<\/li>\n<li>Array<\/li>\n<li>Boolean<\/li>\n<\/ul>\n<h2>So what data type is this supposed to be?<\/h2>\n<pre class=\"brush: jscript; title: ; notranslate\" title=\"\">\r\n\r\n\/\/ Is this an array data type\r\n\/\/ Or an object data type?\r\nvar isThisAnObject = new Array();\r\n\r\n<\/pre>\n<p>I guess it would be proper to say that an array is an object, so instead of separating the two keywords to distinguish a data type &#8211; you can just call it an &#8220;Array Object&#8221;. <\/p>\n<p>Arrays are objects because we can perform or execute methods and properties on arrays like we would an object. Consider the following. <\/p>\n<pre class=\"brush: jscript; title: ; notranslate\" title=\"\">\r\n\r\n\/\/ let's use an object literal instead\r\n\/\/ to create an array\r\n\r\nvar arrayObject = &#x5B;1, 2, 3, 4, 5];\r\n\r\n\/\/ let's get the length of our\r\n\/\/ defined array\r\n\r\nconsole.log(arrayObject.length); \/\/ will output 5\r\n\r\n<\/pre>\n<p>The length property is accessed using object dot notation, we simply chain a property to our target array object.<\/p>\n<h2>What about an array method?<\/h2>\n<p>It&#8217;s the same deal, we use object notation to access an object method. <\/p>\n<pre class=\"brush: jscript; title: ; notranslate\" title=\"\">\r\n\r\nvar arrayObjectSort = &#x5B;4, 3, 1, 2, 5];\r\n\r\nconsole.log(arrayObjectSort.sort()); \r\n\r\n\/\/ will output &#x5B;1, 2, 3, 4, 5]\r\n\r\n<\/pre>\n<p>The sort() method will do the work for us simply by &#8220;envoking&#8221; or &#8220;calling&#8221; the sort() method. Running any additional property or method on an any type of object works exactly the same. So once you get the hang of it, it&#8217;s the same all across the board.<\/p>\n<pre class=\"brush: jscript; title: ; notranslate\" title=\"\">\r\n\r\nvar arrayObjectReverse = &#x5B;1, 2, 3, 4, 5];\r\n\r\nconsole.log(arrayObjectReverse.reverse());\r\n\r\n\/\/ will output &#x5B;5, 4, 3, 2, 1]\r\n\r\n<\/pre>\n<p>Javascript has a lot of built in object properties and methods &#8211; instead of memorizing all of them I would focus more on a thorough understanding of objects work. Just like what were doing here. <\/p>\n<h2>What if I have some property of method that&#8217;s not built-in?<\/h2>\n<p>Well in this case you will have to write one of your own &#8211; and this is where things get really interesting. But were jumping ahead here. In order to effectively write our own methods and properties, we also need a thorough understanding of how functions work. Note that functions themselves are also object or &#8220;first class citizens&#8221; in that they can be passed around like the other data types mentioned. Yeah I know what you&#8217;re thinking, this is getting super complicated. Well I&#8217;m not going to lie, it is and it&#8217;s just something you have to grind through as a programmer. <\/p>\n","protected":false},"excerpt":{"rendered":"<p>Welcome to Javascript Fundamentals Part 2. Javascript is such an endless pit of code this will be somewhat of an infinite series of parts. To recap, I covered data types, loops, and a few conditional structures in part 1 of this series. I&#8217;ve decided to cover object method and properties &#8211; a few basic ones. &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/www.projectimmerse.com\/blog\/javascript-fundamentals-part-2\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Javascript Fundamentals Part 2&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":1159,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[56],"tags":[],"class_list":["post-319","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-programming-fundamentals"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v28.4 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Javascript Fundamentals Part 2 - Project Immerse<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.projectimmerse.com\/blog\/javascript-fundamentals-part-2\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Javascript Fundamentals Part 2 - Project Immerse\" \/>\n<meta property=\"og:description\" content=\"Welcome to Javascript Fundamentals Part 2. Javascript is such an endless pit of code this will be somewhat of an infinite series of parts. To recap, I covered data types, loops, and a few conditional structures in part 1 of this series. I&#8217;ve decided to cover object method and properties &#8211; a few basic ones. &hellip; Continue reading &quot;Javascript Fundamentals Part 2&quot;\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.projectimmerse.com\/blog\/javascript-fundamentals-part-2\/\" \/>\n<meta property=\"og:site_name\" content=\"Project Immerse\" \/>\n<meta property=\"article:published_time\" content=\"2018-09-13T22:40:06+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2020-06-17T08:12:08+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.projectimmerse.com\/blog\/wp-content\/uploads\/2018\/09\/javascript-fundamentals-part-2-1.png\" \/>\n\t<meta property=\"og:image:width\" content=\"750\" \/>\n\t<meta property=\"og:image:height\" content=\"750\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Alex Mercer\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Alex Mercer\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.projectimmerse.com\\\/blog\\\/javascript-fundamentals-part-2\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.projectimmerse.com\\\/blog\\\/javascript-fundamentals-part-2\\\/\"},\"author\":{\"name\":\"Alex Mercer\",\"@id\":\"https:\\\/\\\/www.projectimmerse.com\\\/blog\\\/#\\\/schema\\\/person\\\/c53f2864be524ee6fa08a7e4800dd1e5\"},\"headline\":\"Javascript Fundamentals Part 2\",\"datePublished\":\"2018-09-13T22:40:06+00:00\",\"dateModified\":\"2020-06-17T08:12:08+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.projectimmerse.com\\\/blog\\\/javascript-fundamentals-part-2\\\/\"},\"wordCount\":463,\"commentCount\":0,\"image\":{\"@id\":\"https:\\\/\\\/www.projectimmerse.com\\\/blog\\\/javascript-fundamentals-part-2\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.projectimmerse.com\\\/blog\\\/wp-content\\\/uploads\\\/2018\\\/09\\\/javascript-fundamentals-part-2-1.png\",\"articleSection\":[\"Programming Fundamentals\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.projectimmerse.com\\\/blog\\\/javascript-fundamentals-part-2\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.projectimmerse.com\\\/blog\\\/javascript-fundamentals-part-2\\\/\",\"url\":\"https:\\\/\\\/www.projectimmerse.com\\\/blog\\\/javascript-fundamentals-part-2\\\/\",\"name\":\"Javascript Fundamentals Part 2 - Project Immerse\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.projectimmerse.com\\\/blog\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.projectimmerse.com\\\/blog\\\/javascript-fundamentals-part-2\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.projectimmerse.com\\\/blog\\\/javascript-fundamentals-part-2\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.projectimmerse.com\\\/blog\\\/wp-content\\\/uploads\\\/2018\\\/09\\\/javascript-fundamentals-part-2-1.png\",\"datePublished\":\"2018-09-13T22:40:06+00:00\",\"dateModified\":\"2020-06-17T08:12:08+00:00\",\"author\":{\"@id\":\"https:\\\/\\\/www.projectimmerse.com\\\/blog\\\/#\\\/schema\\\/person\\\/c53f2864be524ee6fa08a7e4800dd1e5\"},\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.projectimmerse.com\\\/blog\\\/javascript-fundamentals-part-2\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.projectimmerse.com\\\/blog\\\/javascript-fundamentals-part-2\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.projectimmerse.com\\\/blog\\\/javascript-fundamentals-part-2\\\/#primaryimage\",\"url\":\"https:\\\/\\\/www.projectimmerse.com\\\/blog\\\/wp-content\\\/uploads\\\/2018\\\/09\\\/javascript-fundamentals-part-2-1.png\",\"contentUrl\":\"https:\\\/\\\/www.projectimmerse.com\\\/blog\\\/wp-content\\\/uploads\\\/2018\\\/09\\\/javascript-fundamentals-part-2-1.png\",\"width\":750,\"height\":750,\"caption\":\"Javascript Fundamentals Part 2\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.projectimmerse.com\\\/blog\\\/javascript-fundamentals-part-2\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.projectimmerse.com\\\/blog\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Javascript Fundamentals Part 2\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.projectimmerse.com\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/www.projectimmerse.com\\\/blog\\\/\",\"name\":\"Project Immerse\",\"description\":\"\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.projectimmerse.com\\\/blog\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.projectimmerse.com\\\/blog\\\/#\\\/schema\\\/person\\\/c53f2864be524ee6fa08a7e4800dd1e5\",\"name\":\"Alex Mercer\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.projectimmerse.com\\\/blog\\\/wp-content\\\/uploads\\\/2026\\\/09\\\/alex-mercer-author-150x150.png\",\"url\":\"https:\\\/\\\/www.projectimmerse.com\\\/blog\\\/wp-content\\\/uploads\\\/2026\\\/09\\\/alex-mercer-author-150x150.png\",\"contentUrl\":\"https:\\\/\\\/www.projectimmerse.com\\\/blog\\\/wp-content\\\/uploads\\\/2026\\\/09\\\/alex-mercer-author-150x150.png\",\"caption\":\"Alex Mercer\"},\"description\":\"Alex Mercer is a writer and contributor at Project Immerse, covering web design, WordPress, web development, SEO, digital strategy, emerging technology, and the evolving world of the web. His work focuses on practical ideas, useful tools, and approachable guidance that help creators, developers, and business owners build better digital experiences. Alex writes with a hands-on, curiosity-driven approach, exploring both established web practices and new technologies shaping how websites are designed, built, and discovered.\",\"sameAs\":[\"https:\\\/\\\/www.projectimmerse.com\"],\"url\":\"https:\\\/\\\/www.projectimmerse.com\\\/blog\\\/author\\\/projectimmerse\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Javascript Fundamentals Part 2 - Project Immerse","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.projectimmerse.com\/blog\/javascript-fundamentals-part-2\/","og_locale":"en_US","og_type":"article","og_title":"Javascript Fundamentals Part 2 - Project Immerse","og_description":"Welcome to Javascript Fundamentals Part 2. Javascript is such an endless pit of code this will be somewhat of an infinite series of parts. To recap, I covered data types, loops, and a few conditional structures in part 1 of this series. I&#8217;ve decided to cover object method and properties &#8211; a few basic ones. &hellip; Continue reading \"Javascript Fundamentals Part 2\"","og_url":"https:\/\/www.projectimmerse.com\/blog\/javascript-fundamentals-part-2\/","og_site_name":"Project Immerse","article_published_time":"2018-09-13T22:40:06+00:00","article_modified_time":"2020-06-17T08:12:08+00:00","og_image":[{"width":750,"height":750,"url":"https:\/\/www.projectimmerse.com\/blog\/wp-content\/uploads\/2018\/09\/javascript-fundamentals-part-2-1.png","type":"image\/png"}],"author":"Alex Mercer","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Alex Mercer","Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.projectimmerse.com\/blog\/javascript-fundamentals-part-2\/#article","isPartOf":{"@id":"https:\/\/www.projectimmerse.com\/blog\/javascript-fundamentals-part-2\/"},"author":{"name":"Alex Mercer","@id":"https:\/\/www.projectimmerse.com\/blog\/#\/schema\/person\/c53f2864be524ee6fa08a7e4800dd1e5"},"headline":"Javascript Fundamentals Part 2","datePublished":"2018-09-13T22:40:06+00:00","dateModified":"2020-06-17T08:12:08+00:00","mainEntityOfPage":{"@id":"https:\/\/www.projectimmerse.com\/blog\/javascript-fundamentals-part-2\/"},"wordCount":463,"commentCount":0,"image":{"@id":"https:\/\/www.projectimmerse.com\/blog\/javascript-fundamentals-part-2\/#primaryimage"},"thumbnailUrl":"https:\/\/www.projectimmerse.com\/blog\/wp-content\/uploads\/2018\/09\/javascript-fundamentals-part-2-1.png","articleSection":["Programming Fundamentals"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.projectimmerse.com\/blog\/javascript-fundamentals-part-2\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.projectimmerse.com\/blog\/javascript-fundamentals-part-2\/","url":"https:\/\/www.projectimmerse.com\/blog\/javascript-fundamentals-part-2\/","name":"Javascript Fundamentals Part 2 - Project Immerse","isPartOf":{"@id":"https:\/\/www.projectimmerse.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.projectimmerse.com\/blog\/javascript-fundamentals-part-2\/#primaryimage"},"image":{"@id":"https:\/\/www.projectimmerse.com\/blog\/javascript-fundamentals-part-2\/#primaryimage"},"thumbnailUrl":"https:\/\/www.projectimmerse.com\/blog\/wp-content\/uploads\/2018\/09\/javascript-fundamentals-part-2-1.png","datePublished":"2018-09-13T22:40:06+00:00","dateModified":"2020-06-17T08:12:08+00:00","author":{"@id":"https:\/\/www.projectimmerse.com\/blog\/#\/schema\/person\/c53f2864be524ee6fa08a7e4800dd1e5"},"breadcrumb":{"@id":"https:\/\/www.projectimmerse.com\/blog\/javascript-fundamentals-part-2\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.projectimmerse.com\/blog\/javascript-fundamentals-part-2\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.projectimmerse.com\/blog\/javascript-fundamentals-part-2\/#primaryimage","url":"https:\/\/www.projectimmerse.com\/blog\/wp-content\/uploads\/2018\/09\/javascript-fundamentals-part-2-1.png","contentUrl":"https:\/\/www.projectimmerse.com\/blog\/wp-content\/uploads\/2018\/09\/javascript-fundamentals-part-2-1.png","width":750,"height":750,"caption":"Javascript Fundamentals Part 2"},{"@type":"BreadcrumbList","@id":"https:\/\/www.projectimmerse.com\/blog\/javascript-fundamentals-part-2\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.projectimmerse.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Javascript Fundamentals Part 2"}]},{"@type":"WebSite","@id":"https:\/\/www.projectimmerse.com\/blog\/#website","url":"https:\/\/www.projectimmerse.com\/blog\/","name":"Project Immerse","description":"","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.projectimmerse.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/www.projectimmerse.com\/blog\/#\/schema\/person\/c53f2864be524ee6fa08a7e4800dd1e5","name":"Alex Mercer","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.projectimmerse.com\/blog\/wp-content\/uploads\/2026\/09\/alex-mercer-author-150x150.png","url":"https:\/\/www.projectimmerse.com\/blog\/wp-content\/uploads\/2026\/09\/alex-mercer-author-150x150.png","contentUrl":"https:\/\/www.projectimmerse.com\/blog\/wp-content\/uploads\/2026\/09\/alex-mercer-author-150x150.png","caption":"Alex Mercer"},"description":"Alex Mercer is a writer and contributor at Project Immerse, covering web design, WordPress, web development, SEO, digital strategy, emerging technology, and the evolving world of the web. His work focuses on practical ideas, useful tools, and approachable guidance that help creators, developers, and business owners build better digital experiences. Alex writes with a hands-on, curiosity-driven approach, exploring both established web practices and new technologies shaping how websites are designed, built, and discovered.","sameAs":["https:\/\/www.projectimmerse.com"],"url":"https:\/\/www.projectimmerse.com\/blog\/author\/projectimmerse\/"}]}},"_links":{"self":[{"href":"https:\/\/www.projectimmerse.com\/blog\/wp-json\/wp\/v2\/posts\/319","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.projectimmerse.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.projectimmerse.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.projectimmerse.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.projectimmerse.com\/blog\/wp-json\/wp\/v2\/comments?post=319"}],"version-history":[{"count":7,"href":"https:\/\/www.projectimmerse.com\/blog\/wp-json\/wp\/v2\/posts\/319\/revisions"}],"predecessor-version":[{"id":450,"href":"https:\/\/www.projectimmerse.com\/blog\/wp-json\/wp\/v2\/posts\/319\/revisions\/450"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.projectimmerse.com\/blog\/wp-json\/wp\/v2\/media\/1159"}],"wp:attachment":[{"href":"https:\/\/www.projectimmerse.com\/blog\/wp-json\/wp\/v2\/media?parent=319"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.projectimmerse.com\/blog\/wp-json\/wp\/v2\/categories?post=319"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.projectimmerse.com\/blog\/wp-json\/wp\/v2\/tags?post=319"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}