{"id":19143,"date":"2020-07-07T04:04:31","date_gmt":"2020-07-07T11:04:31","guid":{"rendered":"https:\/\/careerkarma.com\/blog\/?p=19143"},"modified":"2023-12-01T03:39:33","modified_gmt":"2023-12-01T11:39:33","slug":"javascript-class","status":"publish","type":"post","link":"https:\/\/careerkarma.com\/blog\/javascript-class\/","title":{"rendered":"JavaScript Class: A Guide"},"content":{"rendered":"\n<p>JavaScript is based on prototypes. Every time you declare an object, a prototype property is created which extends the properties and methods associated with that object.<br><\/p>\n\n\n\n<p>Over the last few years, many JavaScript developers have sought ways to incorporate object-oriented design into their code. This has given rise to a new type of object in JavaScript called a class, which extends a prototype.<br><\/p>\n\n\n\n<p>In this guide, we\u2019re going to discuss what classes are, why they are used, and how you can implement a class in your code. We\u2019ll walk through an example to help you get started with classes.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">What is a JavaScript Class?<\/h2>\n\n\n\n<p>Classes are a way to declare a template for an object.<br><\/p>\n\n\n\n<p>If you\u2019re familiar with object-oriented programming languages, you\u2019ll know that they depend heavily on classes and objects. A class is like a blueprint for a type of data: it says what data can be stored and what methods it can access. An object is an instance of that class.<br><\/p>\n\n\n\n<p>An example of a class would be <code>Book<\/code>. This class would contain the blueprint for what information could be stored on books and how that data could be changed. An object could be A Streetcar Named Desire, which is an individual book.<br><\/p>\n\n\n\n<p>In JavaScript, classes are what we call syntactic sugar. The class syntax is sweet to have, but they do not necessarily add in any new functionality.<br><\/p>\n\n\n\n<p>Classes are commonly used in modern JavaScript frameworks such as React and Next.js.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Classes vs. Functions<\/h2>\n\n\n\n<p>If you remember one thing from this article, let it be this: classes are just normal functions.<br><\/p>\n\n\n\n<p>The only difference between a class and a function expression is how they are declared; functions use the <code>function<\/code> keyword and classes use the <code>class<\/code> keyword. Technically, you could declare a class without even using the class keyword.<br><\/p>\n\n\n\n<p>We can tell that they are the same by creating two functions and printing out their prototypes:<br><\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>const PlayerFunction = function() {}\nconst PlayerClass = class {}\nconsole.log(Object.getPrototypeOf(PlayerFunction));\nconsole.log(Object.getPrototypeOf(PlayerClass));\n<\/pre><\/div>\n\n\n\n<p>Our class expression and function returns:<br><\/p>\n\n\n\n<p>function ()<\/p>\n\n\n\n<p>function ()<br><\/p>\n\n\n\n<p>Both our functions and classes use the same prototype-based architecture.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">How to Define a Class<\/h2>\n\n\n\n<p>How do you define a class? That&#8217;s a great question.<br><\/p>\n\n\n\n<p>You can define a class using the <code>class<\/code> keyword. Once you\u2019ve defined a class, you can use the constructor() function to initialize it with some default values.<br><\/p>\n\n\n\n<p>Open up a JavaScript console and paste in this code:<br><\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>\tclass Book {\nconstructor(title, author) {\n\t\tthis.title = title;\n\t\tthis.author = author;\n\t}\n}\n<\/pre><\/div>\n\n\n\n<p>This creates a class called <code>Book<\/code>. Our class can store two values, title and author, which we defined in our class constructor method. To create an object of this class, we could use this code:<br><\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>var streetcar = new Book(\"A Streetcar Named Desire\", \"Tennessee Williams\");\n<\/pre><\/div>\n\n\n\n<p>We can retrieve values from our class like we would from any object:<br><\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>console.log(streetcar.title);\n<\/pre><\/div>\n\n\n\n<p>Our code returns: A Streetcar Named Desire.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">How to Define a Class Method<\/h2>\n\n\n\n<p>One of the benefits of using classes over prototypes is that you can declare a method inside a class. This means that you don&#8217;t need to use the <code>prototype<\/code> syntax to add a new method to an existing function.<br><\/p>\n\n\n\n<p>Consider this example:<br><\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>class Book {\n\tconstructor(title, author) {\n\t\tthis.title = title;\n\t\tthis.author = author;\n\t}\n\t\n\tgetDetails() {\n\t\tconsole.log(`${this.title} is a book written by ${this.author}.`);\n\t}\n}\n<\/pre><\/div>\n\n\n\n<p>We\u2019ve declared a method called <code>getDetails()<\/code> which exists inside our class. This is nice because it keeps all of our code grouped together. Let\u2019s call our <code>getDetails() <\/code>function:<br><\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>var streetcar = new Book(\"A Streetcar Named Desire\", \"Tennessee Williams\");\nstreetcar.getDetails();\n<\/pre><\/div>\n\n\n\n<p>Our code returns:<br><\/p>\n\n\n\n<p>A Streetcar Named Desire is a book written by Tennessee Williams.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Inheriting Classes<\/h2>\n\n\n\n<p>Like in any object-oriented structure, classes can inherit properties from other classes.<br><\/p>\n\n\n\n<p>Inheritance refers to a process where a child class can access methods and data from a parent class. To inherit a class, you can use the <code>extends<\/code> keyword. Create a JavaScript file or open your JavaScript console and paste in this code:<br><\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>class Fiction extends Book {\n\tconstructor(title, author, fiction) {\n\t\tsuper(title, author);\n\t\tthis.fiction = true;\n\t}\n}\n<\/pre><\/div>\n\n\n\n<p>We\u2019ve created a class called Fiction which uses the Book class we declared earlier as a blueprint. In our code, we\u2019ve used the <code>super()<\/code> keyword to inherit the values title and author from the parent class, which is Book. Then, we\u2019ve defined a new attribute, <code>fiction<\/code>, whose value is set to true by default.<br><\/p>\n\n\n\n<p>Let\u2019s create an object of our new Fiction class:<br><\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>var gatsby = new Fiction(\"The Great Gatsby\", \"F. Scott Fitzgerald\");\nconsole.log(gatsby.fiction);\n<\/pre><\/div>\n\n\n\n<p>Our code returns: true. The Fiction class stores an item called <code>fiction<\/code> which is true by default. If we tried to access this value from an instance of the Book class, nothing would be returned. That&#8217;s because &#8220;fiction&#8221; is only accessible in our Fiction class.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Getters and Setters<\/h2>\n\n\n\n<p>When you\u2019re working with classes, you should make use of the getter and setter functions.<br><\/p>\n\n\n\n<p>Getter functions allow you to retrieve methods from a class. Setter functions allow you to change the value of a particular item in a class. These functions are denoted using the <code>get<\/code> and <code>set<\/code> keywords, respectively.<br><\/p>\n\n\n\n<p>Consider the following code:<br><\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>class Book {\n\tconstructor(title, author) {\n\t\tthis.title = title;\n\t\tthis.author = author;\n\t}\n\t\n\tget author() {\n\t\treturn this.author;\n\t}\n\tset author(author) {\n\t\tthis.author = author;\n\t}\n}\n<\/pre><\/div>\n\n\n\n<p>In this example, we\u2019ve declared two methods called <code>author<\/code>. One of these methods allows us to retrieve the value of <code>author<\/code>; that\u2019s our <code>get<\/code> method. The other method allows us to change the value of <code>author<\/code>.<br><\/p>\n\n\n\n<p>We can see this in action using the following code:<br><\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>var streetcar = new Book(\"A Streetcar Named Desire\", \"\");\nstreetcar.author = \"Tennessee Williams\";\nconsole.log(streetcar.author);\n<\/pre><\/div>\n\n\n\n<p>Our code returns: Tennessee Williams.<br><\/p>\n\n\n\n<p>We\u2019ve initialized an object called <code>streetcar<\/code> and gave it the title <code>A Streetcar Named Desire<\/code>. We then set the value of <code>author<\/code> to <code>Tennessee Williams<\/code> using the setter that we defined in our code. Finally, we printed out the value of <code>author<\/code> to the console using the getter method.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Conclusion<\/h2>\n\n\n\n<p>While classes do not add any new functionality into JavaScript, they do make writing functions easier to understand if you\u2019re used to object-oriented programming.<br><\/p>\n\n\n\n<p>Classes abstract the prototype-based design of JavaScript and make it seem more object-oriented. The word \u201cseem\u201d is crucial because, remember, classes are functions. Classes are nothing more than syntactic sugar.<br><\/p>\n\n\n\n<p>Now you\u2019re ready to start using classes like a JavaScript expert!<br><\/p>\n","protected":false},"excerpt":{"rendered":"JavaScript is based on prototypes. Every time you declare an object, a prototype property is created which extends the properties and methods associated with that object. Over the last few years, many JavaScript developers have sought ways to incorporate object-oriented design into their code. This has given rise to a new type of object in&hellip;","protected":false},"author":240,"featured_media":19144,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[11933],"tags":[],"class_list":{"0":"post-19143","1":"post","2":"type-post","3":"status-publish","4":"format-standard","5":"has-post-thumbnail","7":"category-javascript"},"acf":{"post_sub_title":"","sprint_id":"","query_class":"JavaScript","school_sft":"","parent_sft":"","school_privacy_policy":"","has_review":"","is_sponser_post":"","is_guest_post":""},"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v27.4 (Yoast SEO v27.4) - https:\/\/yoast.com\/product\/yoast-seo-premium-wordpress\/ -->\n<title>JavaScript Class: A Guide | Career Karma<\/title>\n<meta name=\"description\" content=\"Classes allow you to use an object-oriented structure in your JavaScript code. On Career Karma, learn how classes work and how you can use them in your code.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/careerkarma.com\/blog\/javascript-class\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"JavaScript Class: A Guide\" \/>\n<meta property=\"og:description\" content=\"Classes allow you to use an object-oriented structure in your JavaScript code. On Career Karma, learn how classes work and how you can use them in your code.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/careerkarma.com\/blog\/javascript-class\/\" \/>\n<meta property=\"og:site_name\" content=\"Career Karma\" \/>\n<meta property=\"article:publisher\" content=\"http:\/\/facebook.com\/careerkarmaapp\" \/>\n<meta property=\"article:published_time\" content=\"2020-07-07T11:04:31+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2023-12-01T11:39:33+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/07\/laptop-remote-working-writing-typing-7114.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"1000\" \/>\n\t<meta property=\"og:image:height\" content=\"667\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"James Gallagher\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@career_karma\" \/>\n<meta name=\"twitter:site\" content=\"@career_karma\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"James Gallagher\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"4 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/javascript-class\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/javascript-class\\\/\"},\"author\":{\"name\":\"James Gallagher\",\"@id\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/#\\\/schema\\\/person\\\/e79364792443fbff794a144c67ec8e94\"},\"headline\":\"JavaScript Class: A Guide\",\"datePublished\":\"2020-07-07T11:04:31+00:00\",\"dateModified\":\"2023-12-01T11:39:33+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/javascript-class\\\/\"},\"wordCount\":921,\"commentCount\":0,\"image\":{\"@id\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/javascript-class\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/wp-content\\\/uploads\\\/2020\\\/07\\\/laptop-remote-working-writing-typing-7114.jpg\",\"articleSection\":[\"JavaScript\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/careerkarma.com\\\/blog\\\/javascript-class\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/javascript-class\\\/\",\"url\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/javascript-class\\\/\",\"name\":\"JavaScript Class: A Guide | Career Karma\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/javascript-class\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/javascript-class\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/wp-content\\\/uploads\\\/2020\\\/07\\\/laptop-remote-working-writing-typing-7114.jpg\",\"datePublished\":\"2020-07-07T11:04:31+00:00\",\"dateModified\":\"2023-12-01T11:39:33+00:00\",\"author\":{\"@id\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/#\\\/schema\\\/person\\\/e79364792443fbff794a144c67ec8e94\"},\"description\":\"Classes allow you to use an object-oriented structure in your JavaScript code. On Career Karma, learn how classes work and how you can use them in your code.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/javascript-class\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/careerkarma.com\\\/blog\\\/javascript-class\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/javascript-class\\\/#primaryimage\",\"url\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/wp-content\\\/uploads\\\/2020\\\/07\\\/laptop-remote-working-writing-typing-7114.jpg\",\"contentUrl\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/wp-content\\\/uploads\\\/2020\\\/07\\\/laptop-remote-working-writing-typing-7114.jpg\",\"width\":1000,\"height\":667},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/javascript-class\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Blog\",\"item\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"JavaScript\",\"item\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/javascript\\\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"JavaScript Class: A Guide\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/\",\"name\":\"Career Karma\",\"description\":\"Latest Coding Bootcamp News &amp; Career Hacks from Industry Insiders\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/#\\\/schema\\\/person\\\/e79364792443fbff794a144c67ec8e94\",\"name\":\"James Gallagher\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/wp-content\\\/uploads\\\/2020\\\/01\\\/james-gallagher-150x150.jpg\",\"url\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/wp-content\\\/uploads\\\/2020\\\/01\\\/james-gallagher-150x150.jpg\",\"contentUrl\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/wp-content\\\/uploads\\\/2020\\\/01\\\/james-gallagher-150x150.jpg\",\"caption\":\"James Gallagher\"},\"description\":\"James Gallagher is a self-taught programmer and the technical content manager at Career Karma. He has experience in range of programming languages and extensive expertise in Python, HTML, CSS, and JavaScript. James has written hundreds of programming tutorials, and he frequently contributes to publications like Codecademy, Treehouse, Repl.it, Afrotech, and others.\",\"url\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/author\\\/jamesgallagher\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"JavaScript Class: A Guide | Career Karma","description":"Classes allow you to use an object-oriented structure in your JavaScript code. On Career Karma, learn how classes work and how you can use them in your code.","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:\/\/careerkarma.com\/blog\/javascript-class\/","og_locale":"en_US","og_type":"article","og_title":"JavaScript Class: A Guide","og_description":"Classes allow you to use an object-oriented structure in your JavaScript code. On Career Karma, learn how classes work and how you can use them in your code.","og_url":"https:\/\/careerkarma.com\/blog\/javascript-class\/","og_site_name":"Career Karma","article_publisher":"http:\/\/facebook.com\/careerkarmaapp","article_published_time":"2020-07-07T11:04:31+00:00","article_modified_time":"2023-12-01T11:39:33+00:00","og_image":[{"width":1000,"height":667,"url":"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/07\/laptop-remote-working-writing-typing-7114.jpg","type":"image\/jpeg"}],"author":"James Gallagher","twitter_card":"summary_large_image","twitter_creator":"@career_karma","twitter_site":"@career_karma","twitter_misc":{"Written by":"James Gallagher","Est. reading time":"4 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/careerkarma.com\/blog\/javascript-class\/#article","isPartOf":{"@id":"https:\/\/careerkarma.com\/blog\/javascript-class\/"},"author":{"name":"James Gallagher","@id":"https:\/\/careerkarma.com\/blog\/#\/schema\/person\/e79364792443fbff794a144c67ec8e94"},"headline":"JavaScript Class: A Guide","datePublished":"2020-07-07T11:04:31+00:00","dateModified":"2023-12-01T11:39:33+00:00","mainEntityOfPage":{"@id":"https:\/\/careerkarma.com\/blog\/javascript-class\/"},"wordCount":921,"commentCount":0,"image":{"@id":"https:\/\/careerkarma.com\/blog\/javascript-class\/#primaryimage"},"thumbnailUrl":"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/07\/laptop-remote-working-writing-typing-7114.jpg","articleSection":["JavaScript"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/careerkarma.com\/blog\/javascript-class\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/careerkarma.com\/blog\/javascript-class\/","url":"https:\/\/careerkarma.com\/blog\/javascript-class\/","name":"JavaScript Class: A Guide | Career Karma","isPartOf":{"@id":"https:\/\/careerkarma.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/careerkarma.com\/blog\/javascript-class\/#primaryimage"},"image":{"@id":"https:\/\/careerkarma.com\/blog\/javascript-class\/#primaryimage"},"thumbnailUrl":"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/07\/laptop-remote-working-writing-typing-7114.jpg","datePublished":"2020-07-07T11:04:31+00:00","dateModified":"2023-12-01T11:39:33+00:00","author":{"@id":"https:\/\/careerkarma.com\/blog\/#\/schema\/person\/e79364792443fbff794a144c67ec8e94"},"description":"Classes allow you to use an object-oriented structure in your JavaScript code. On Career Karma, learn how classes work and how you can use them in your code.","breadcrumb":{"@id":"https:\/\/careerkarma.com\/blog\/javascript-class\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/careerkarma.com\/blog\/javascript-class\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/careerkarma.com\/blog\/javascript-class\/#primaryimage","url":"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/07\/laptop-remote-working-writing-typing-7114.jpg","contentUrl":"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/07\/laptop-remote-working-writing-typing-7114.jpg","width":1000,"height":667},{"@type":"BreadcrumbList","@id":"https:\/\/careerkarma.com\/blog\/javascript-class\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Blog","item":"https:\/\/careerkarma.com\/blog\/"},{"@type":"ListItem","position":2,"name":"JavaScript","item":"https:\/\/careerkarma.com\/blog\/javascript\/"},{"@type":"ListItem","position":3,"name":"JavaScript Class: A Guide"}]},{"@type":"WebSite","@id":"https:\/\/careerkarma.com\/blog\/#website","url":"https:\/\/careerkarma.com\/blog\/","name":"Career Karma","description":"Latest Coding Bootcamp News &amp; Career Hacks from Industry Insiders","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/careerkarma.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/careerkarma.com\/blog\/#\/schema\/person\/e79364792443fbff794a144c67ec8e94","name":"James Gallagher","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/01\/james-gallagher-150x150.jpg","url":"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/01\/james-gallagher-150x150.jpg","contentUrl":"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/01\/james-gallagher-150x150.jpg","caption":"James Gallagher"},"description":"James Gallagher is a self-taught programmer and the technical content manager at Career Karma. He has experience in range of programming languages and extensive expertise in Python, HTML, CSS, and JavaScript. James has written hundreds of programming tutorials, and he frequently contributes to publications like Codecademy, Treehouse, Repl.it, Afrotech, and others.","url":"https:\/\/careerkarma.com\/blog\/author\/jamesgallagher\/"}]}},"_links":{"self":[{"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/posts\/19143","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/users\/240"}],"replies":[{"embeddable":true,"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/comments?post=19143"}],"version-history":[{"count":0,"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/posts\/19143\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/media\/19144"}],"wp:attachment":[{"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/media?parent=19143"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/categories?post=19143"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/tags?post=19143"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}