{"id":20209,"date":"2020-07-25T00:27:53","date_gmt":"2020-07-25T07:27:53","guid":{"rendered":"https:\/\/careerkarma.com\/blog\/?p=20209"},"modified":"2023-12-01T03:56:08","modified_gmt":"2023-12-01T11:56:08","slug":"javascript-boolean","status":"publish","type":"post","link":"https:\/\/careerkarma.com\/blog\/javascript-boolean\/","title":{"rendered":"JavaScript Booleans: A Guide"},"content":{"rendered":"\n<h2 class=\"wp-block-heading\">How to Use JavaScript Booleans <\/h2>\n\n\n\n<p>True or false values are everywhere in programming. We call these values Booleans. They can be used to compare two or more values and control what parts of a program should run.<br><\/p>\n\n\n\n<p>In this guide, we\u2019re going to talk about what Booleans are and how they work. We\u2019ll walk through a few examples of how to use JavaScript Booleans to help you get started.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">What is a JavaScript Boolean?<\/h2>\n\n\n\n<p>A Boolean is a value that can either be True or False.<br><\/p>\n\n\n\n<p>Booleans are named after George Boole, a famous mathematician who is associated with advancing the study of mathematical logic. This means that Booleans are always capitalized.<br><\/p>\n\n\n\n<p>Every object with a value in JavaScript is true. Everything without a value is false.<br><\/p>\n\n\n\n<p>The following values all evaluate to true:<br><\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>10<\/li><li>\u201cHello\u201d<\/li><li>True<\/li><\/ul>\n\n\n\n<p>Any null, false, undefined, 0, NaN or empty string value is considered to be false.<br><\/p>\n\n\n\n<p>Let\u2019s discuss how Booleans can be used in JavaScript!<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Using Booleans to Make Comparisons<\/h2>\n\n\n\n<p>There can only be two outcomes of a comparison: true or false. This means that we can use Booleans to evaluate the outcome of a comparison.<br><\/p>\n\n\n\n<p>JavaScript uses <a href=\"https:\/\/careerkarma.com\/discussions\/post\/javascript-operators-cheat-sheet-EAbQMa1a4K4\/\">comparison operators<\/a> to compare two values. These are:<br><\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>==: Equal to<\/li><li>!=: Not equal to<\/li><li>&gt;: Greater than<\/li><li>&lt;: Less than<\/li><li>&lt;=: Less than or equal to<\/li><li>&gt;=: Greater than or equal to<\/li><\/ul>\n\n\n\n<p>When you use the last two operators in the above list, you need to be sure that you arrange the signs in the correct order. JavaScript will not understand your code if you flip the signs around.<br><\/p>\n\n\n\n<p>We\u2019re going to build a program that evaluates the ages of two students in a high school class. Let\u2019s start by checking whether a student, Alex, is older than another student, Lisa:<br><\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>var lisa = 15;\nvar alex = 16;\n\nconsole.log(alex &gt; lisa);<\/pre><\/div>\n\n\n\n<p>Our code returns: true.<br><\/p>\n\n\n\n<p>Alex is 16 and Lisa is 15. This means that Alex is older than Lisa. We can use any comparison operator to evaluate how two <a href=\"https:\/\/careerkarma.com\/blog\/javascript-variables\/\">variables<\/a> compare. Let\u2019s see whether Alex is the same age as another student, Paul:<br><\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>var paul = 16;\nvar alex = 16;\n\nconsole.log(alex == paul);<\/pre><\/div>\n\n\n\n<p>This code checks whether the value of \u201calex\u201d is equal to the value of \u201cpaul\u201d. Both of these students are 16 years old. Our code returns: true.<br><\/p>\n\n\n\n<p>Strings can be evaluated using JavaScript Booleans.<br><\/p>\n\n\n\n<p>Let\u2019s check if the student Lisa is on the honor roll this month:<br><\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>var honor_roll = &quot;Alex&quot;;\nvar student = &quot;Lisa&quot;;\n\nconsole.log(honor_roll == student);<\/pre><\/div>\n\n\n\n<p>Our code returns: false. We are checking to see whether the value of \u201chonor_roll\u201d is equal to the value of \u201cstudent\u201d. The honor roll student is Alex. This means that when we compare our two strings, false is returned. If Lisa was on the honor roll, our code would return true.<br><\/p>\n\n\n\n<p>We can assign the outcome of this comparison to a boolean variable:<br><\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>var is_honor_roll_student = (honor_roll == student);\nconsole.log(is_honor_roll_student); <\/pre><\/div>\n\n\n\n<p>Our code returns: true. This code performs the same comparison. The value of the Boolean object comparison is stored in the variable \u201cis_honor_roll_student\u201d. We then print the value of that variable to the console.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Using Booleans with Logical Operators<\/h2>\n\n\n\n<p>Logical operators are usually used to evaluate two or more expressions. They allow you to check whether two or more statements are true, if one of two statements are true, or if one or more statements are false.<br><\/p>\n\n\n\n<p>There are three logical operators that can be used with Boolean functions:<br><\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>&amp;&amp;: And<\/li><li>||: Or<\/li><li>!: Not<\/li><\/ul>\n\n\n\n<p>Let\u2019s create a program which checks whether you can buy a new computer game from an online store. We\u2019ll first check whether a customer has a high enough gift card balance in your account, or whether a customer has a credit card which can be charged for the computer:<br><\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>var gift_card_balance = 25.00;\nvar cost = 30.00;\nvar card = true;\n\nconsole.log((balance &gt;= cost) or (card == true));<\/pre><\/div>\n\n\n\n<p>This code checks whether the customer has enough money in a gift card or if the customer has a card associated with your account. Our code returns: true.<br><\/p>\n\n\n\n<p>The customer does not have enough money on their gift card balance. They have a card attached to their account. Because one of the two expressions we have specified is true, the expression evaluates to true.<br><\/p>\n\n\n\n<p>The game you are buying is rated 18+. Let\u2019s check whether a customer is over 18 and has enough money to purchase the game:<br><\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>var age = 19;\nvar enough_money = true;\n\nconsole.log((enough_money == true) &amp;&amp; (age &gt;= 18))<\/pre><\/div>\n\n\n\n<p>Our code returns: true. We have used the &amp;&amp; operator to check whether both of our conditions are met. They are met, so our code returns true.<br><\/p>\n\n\n\n<p>We can use the not operator to check if an expression is false. Let\u2019s see whether our customer has purchased a game before:<br><\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>var purchases = 1;\nvar purchased_before = !(purchases == 0);\n\nconsole.log(purchased_before);<\/pre><\/div>\n\n\n\n<p>This code checks whether our customer has purchased a game before. We use the not (\u201c!\u201d) operator to invert the result of purchases == 0. This means that if a customer has purchased a game before, our expression will evaluate to true.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Using Booleans with an if Statement<\/h2>\n\n\n\n<p>Booleans are used to control the flow of a program. This means that you can use a Boolean to determine whether a certain block of code should be run.<br><\/p>\n\n\n\n<p>This code snippet will print out a message to the console if a customer has a sufficient balance on a gift card to purchase a game:<br><\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>var balance = 25.00;\nvar cost = 30.00;\n\nif (balance &gt;= cost) {\n\tconsole.log(&quot;This gift card has enough money.&quot;);\n} else {\n\tconsole.log(&quot;This gift card has an insufficient balance.&quot;);\n}<\/pre><\/div>\n\n\n\n<p>This code returns: This gift card has an insufficient balance.<br><\/p>\n\n\n\n<p>Our code evaluates whether the customer\u2019s balance is equal to or greater than the cost of the game. If the customer has enough money, the code inside our <a href=\"https:\/\/careerkarma.com\/blog\/javascript-if-else\/\">\u201dif\u201d statement<\/a> is run. Otherwise, the code inside our <code>else<\/code> statement is run.<br><\/p>\n\n\n\n<p>Let\u2019s see what happens when we change the value of \u201cbalance\u201d to $32.50:<br><\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>var balance = 32.50;\n...<\/pre><\/div>\n\n\n\n<p>Our code returns: This gift card has enough money.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Conclusion<\/h2>\n\n\n\n<p>A Boolean can store a true or false value. Booleans are commonly used to evaluate whether an expression is true or false. You can use a Boolean with an <code>if<\/code> statement to run a block of code based on whether an expression evaluates to a certain Boolean value.<br><\/p>\n\n\n\n<p>Now you\u2019re ready to start using JavaScript booleans like an expert developer!<\/p>\n","protected":false},"excerpt":{"rendered":"How to Use JavaScript Booleans True or false values are everywhere in programming. We call these values Booleans. They can be used to compare two or more values and control what parts of a program should run. In this guide, we\u2019re going to talk about what Booleans are and how they work. We\u2019ll walk through&hellip;","protected":false},"author":240,"featured_media":20210,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[11933],"tags":[],"class_list":{"0":"post-20209","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":null,"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 Booleans : A Step-By-Step Guide| Career Karma<\/title>\n<meta name=\"description\" content=\"A Boolean can store a value that is either true or false. On Career Karma, learn how to use JavaScript Booleans.\" \/>\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-boolean\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"JavaScript Booleans: A Guide\" \/>\n<meta property=\"og:description\" content=\"A Boolean can store a value that is either true or false. On Career Karma, learn how to use JavaScript Booleans.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/careerkarma.com\/blog\/javascript-boolean\/\" \/>\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-25T07:27:53+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2023-12-01T11:56:08+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/07\/christina-wocintechchat-com-F75IfIWSqRY-unsplash.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"1020\" \/>\n\t<meta property=\"og:image:height\" content=\"681\" \/>\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=\"5 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/javascript-boolean\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/javascript-boolean\\\/\"},\"author\":{\"name\":\"James Gallagher\",\"@id\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/#\\\/schema\\\/person\\\/e79364792443fbff794a144c67ec8e94\"},\"headline\":\"JavaScript Booleans: A Guide\",\"datePublished\":\"2020-07-25T07:27:53+00:00\",\"dateModified\":\"2023-12-01T11:56:08+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/javascript-boolean\\\/\"},\"wordCount\":975,\"commentCount\":0,\"image\":{\"@id\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/javascript-boolean\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/wp-content\\\/uploads\\\/2020\\\/07\\\/christina-wocintechchat-com-F75IfIWSqRY-unsplash.jpg\",\"articleSection\":[\"JavaScript\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/careerkarma.com\\\/blog\\\/javascript-boolean\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/javascript-boolean\\\/\",\"url\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/javascript-boolean\\\/\",\"name\":\"JavaScript Booleans : A Step-By-Step Guide| Career Karma\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/javascript-boolean\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/javascript-boolean\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/wp-content\\\/uploads\\\/2020\\\/07\\\/christina-wocintechchat-com-F75IfIWSqRY-unsplash.jpg\",\"datePublished\":\"2020-07-25T07:27:53+00:00\",\"dateModified\":\"2023-12-01T11:56:08+00:00\",\"author\":{\"@id\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/#\\\/schema\\\/person\\\/e79364792443fbff794a144c67ec8e94\"},\"description\":\"A Boolean can store a value that is either true or false. On Career Karma, learn how to use JavaScript Booleans.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/javascript-boolean\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/careerkarma.com\\\/blog\\\/javascript-boolean\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/javascript-boolean\\\/#primaryimage\",\"url\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/wp-content\\\/uploads\\\/2020\\\/07\\\/christina-wocintechchat-com-F75IfIWSqRY-unsplash.jpg\",\"contentUrl\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/wp-content\\\/uploads\\\/2020\\\/07\\\/christina-wocintechchat-com-F75IfIWSqRY-unsplash.jpg\",\"width\":1020,\"height\":681},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/javascript-boolean\\\/#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 Booleans: 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 Booleans : A Step-By-Step Guide| Career Karma","description":"A Boolean can store a value that is either true or false. On Career Karma, learn how to use JavaScript Booleans.","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-boolean\/","og_locale":"en_US","og_type":"article","og_title":"JavaScript Booleans: A Guide","og_description":"A Boolean can store a value that is either true or false. On Career Karma, learn how to use JavaScript Booleans.","og_url":"https:\/\/careerkarma.com\/blog\/javascript-boolean\/","og_site_name":"Career Karma","article_publisher":"http:\/\/facebook.com\/careerkarmaapp","article_published_time":"2020-07-25T07:27:53+00:00","article_modified_time":"2023-12-01T11:56:08+00:00","og_image":[{"width":1020,"height":681,"url":"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/07\/christina-wocintechchat-com-F75IfIWSqRY-unsplash.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":"5 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/careerkarma.com\/blog\/javascript-boolean\/#article","isPartOf":{"@id":"https:\/\/careerkarma.com\/blog\/javascript-boolean\/"},"author":{"name":"James Gallagher","@id":"https:\/\/careerkarma.com\/blog\/#\/schema\/person\/e79364792443fbff794a144c67ec8e94"},"headline":"JavaScript Booleans: A Guide","datePublished":"2020-07-25T07:27:53+00:00","dateModified":"2023-12-01T11:56:08+00:00","mainEntityOfPage":{"@id":"https:\/\/careerkarma.com\/blog\/javascript-boolean\/"},"wordCount":975,"commentCount":0,"image":{"@id":"https:\/\/careerkarma.com\/blog\/javascript-boolean\/#primaryimage"},"thumbnailUrl":"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/07\/christina-wocintechchat-com-F75IfIWSqRY-unsplash.jpg","articleSection":["JavaScript"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/careerkarma.com\/blog\/javascript-boolean\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/careerkarma.com\/blog\/javascript-boolean\/","url":"https:\/\/careerkarma.com\/blog\/javascript-boolean\/","name":"JavaScript Booleans : A Step-By-Step Guide| Career Karma","isPartOf":{"@id":"https:\/\/careerkarma.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/careerkarma.com\/blog\/javascript-boolean\/#primaryimage"},"image":{"@id":"https:\/\/careerkarma.com\/blog\/javascript-boolean\/#primaryimage"},"thumbnailUrl":"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/07\/christina-wocintechchat-com-F75IfIWSqRY-unsplash.jpg","datePublished":"2020-07-25T07:27:53+00:00","dateModified":"2023-12-01T11:56:08+00:00","author":{"@id":"https:\/\/careerkarma.com\/blog\/#\/schema\/person\/e79364792443fbff794a144c67ec8e94"},"description":"A Boolean can store a value that is either true or false. On Career Karma, learn how to use JavaScript Booleans.","breadcrumb":{"@id":"https:\/\/careerkarma.com\/blog\/javascript-boolean\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/careerkarma.com\/blog\/javascript-boolean\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/careerkarma.com\/blog\/javascript-boolean\/#primaryimage","url":"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/07\/christina-wocintechchat-com-F75IfIWSqRY-unsplash.jpg","contentUrl":"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/07\/christina-wocintechchat-com-F75IfIWSqRY-unsplash.jpg","width":1020,"height":681},{"@type":"BreadcrumbList","@id":"https:\/\/careerkarma.com\/blog\/javascript-boolean\/#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 Booleans: 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\/20209","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=20209"}],"version-history":[{"count":0,"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/posts\/20209\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/media\/20210"}],"wp:attachment":[{"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/media?parent=20209"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/categories?post=20209"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/tags?post=20209"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}