{"id":18702,"date":"2020-06-30T12:38:10","date_gmt":"2020-06-30T19:38:10","guid":{"rendered":"https:\/\/careerkarma.com\/blog\/?p=18702"},"modified":"2023-12-01T03:36:58","modified_gmt":"2023-12-01T11:36:58","slug":"javascript-math","status":"publish","type":"post","link":"https:\/\/careerkarma.com\/blog\/javascript-math\/","title":{"rendered":"JavaScript Math: A Guide for Beginners"},"content":{"rendered":"\n<p>Computers are really good at math. It\u2019s in their metaphorical blood, considering computers are powered by the 1s and 0s that we call binary. When you\u2019re coding, there\u2019s probably going to be a time when you want to perform some mathematical operation.<br><\/p>\n\n\n\n<p>In JavaScript, math comes up all the time. You can use math to calculate the size of a window. You can use it to calculate whether a user is old enough to use your site. You can use math to add together two numbers provided by the user.<br><\/p>\n\n\n\n<p>In this guide, we\u2019re going to talk about how to perform mathematical operations in JavaScript using the five main mathematical operators.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Mathematical Operators: A Refresher<\/h2>\n\n\n\n<p>JavaScript is made up of a number of operators. Some operators allow you to work with strings, whereas others help you perform JS math functions. In this guide, we\u2019re going to focus on a special type of operator called an arithmetic operator.<br><\/p>\n\n\n\n<p>Arithmetic operators are the symbols used to perform mathematical tasks. These JS operators are somewhat similar to the ones that you learned in school. For this article, we\u2019re going to focus on six operators:<br><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Addition (+)<\/li>\n\n\n\n<li>Subtraction (-)<\/li>\n\n\n\n<li>Division (\/)<\/li>\n\n\n\n<li>Multiplication (*)<\/li>\n\n\n\n<li>Modulo (%)<\/li>\n\n\n\n<li>Power (**)<\/li>\n<\/ul>\n\n\n\n<p>Let\u2019s get started and delve into each of these.<br><\/p>\n\n\n\n<p>Before we begin, it\u2019s worth noting that all JavaScript numbers are stored as numbers. There is no separate data type for floating-point (decimal) numbers or whole numbers. We simply refer to them all as \u201cnumbers.\u201d<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Adding and Subtracting<\/h2>\n\n\n\n<p>The JavaScript symbols for adding and subtracting JS numbers are the same as we use in our day-to-day lives for math. How convenient! We can add numbers together by stating the numbers we want to add, separated by a plus sign:<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>console.log(5 + 9);<\/pre><\/div>\n\n\n\n<p>Our code returns: 14. We could perform a subtraction sum by substituting our plus for a minus:<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>console.log(5 - 9);<\/pre><\/div>\n\n\n\n<p>Our code returns: -4.<\/p>\n\n\n\n<p>JavaScript math is capable of working with both positive and negative numbers.&nbsp;<br><\/p>\n\n\n\n<p>When you\u2019re working with a math sum, you are probably not going to just print it to the console. That\u2019s where variables come in. You can assign the numbers in your math problems to store all the numbers with which you are working:<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>var a = 10;\nvar b = 20;\nvar c = a + b;\nconsole.log(c);<\/pre><\/div>\n\n\n\n<p>Our code returns: <code>30<\/code>. We\u2019ve assigned the value <code>10<\/code> to <code>a<\/code> and the value <code>20<\/code> to <code>b<\/code>. Then, we\u2019ve used the variable <code>c<\/code> to add these two numbers together. It\u2019s that simple!<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Multiply and Divide<\/h2>\n\n\n\n<p>Let\u2019s go up a level and talk about multiplication and division. Unlike the previous examples, we\u2019re going to have to learn two new operators:<br><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>The asterisk (*) represents multiplication.<\/li>\n\n\n\n<li>The forward-slash (\/) represents division.<\/li>\n<\/ul>\n\n\n\n<p>Let\u2019s say that we own a cookie store and we want to figure out how many kilograms of flour we need. Each batch of cookies requires 2kg of flour, and we want to bake five batches. We could calculate how many kilograms of flour we need using this code:<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>var batches = 5;\nvar flourQuantity = 2;\nvar flourNeeded = batches * flourQuantity;\nconsole.log(\"You need \", flourNeeded, \"kgs of flour.\");<\/pre><\/div>\n\n\n\n<p>Our code returns: <code>You need 10kgs of flour<\/code>.<br><\/p>\n\n\n\n<p>You can use the forward slash to perform division operations.<br><\/p>\n\n\n\n<p>Let\u2019s say that each batch contains 40 cookies and you want to divide them into packs. Each pack contains 5 cookies. Now, you want to find out how many packs you could make. This could be done using the following code:<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>var batchQuantity = 40;\nvar pack = 5;\nvar packsMade = batchQuantity \/ pack;\nconsole.log(\"You can make \", packsMade, \"packs of cookies.\");<\/pre><\/div>\n\n\n\n<p>Our code returns: <code>You can make 8 packs of cookies<\/code>.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Modulo<\/h2>\n\n\n\n<p>The modulo operator may not be as commonly used as the others but it\u2019s still an important part of JavaScript. The modulo operator calculates the remainder of a number after it\u2019s been divided.<br><\/p>\n\n\n\n<p>In JavaScript, the modulo operation is represented using a percentage sign. Our last example showed us dividing numbers that could be split up evenly. As you know, not all math problems go this way; some return remainders.<br><\/p>\n\n\n\n<p>Let\u2019s go back to our cookie example from earlier. Suppose we\u2019ve overestimated how many cookies we can bake in each batch. It turns out each batch will only yield 37 cookies. To find out how many packs we can make from our batch, we could use this code:<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>var batchQuantity = 37;\nvar pack = 5;\nvar packsMade = batchQuantity \/ pack;\nconsole.log(\"You can make \", packsMade, \"packs of cookies.\");<\/pre><\/div>\n\n\n\n<p>The trouble is that we\u2019ve got a decimal number! That\u2019s where the modulo comes in. We could update our code to calculate the remainder of the cookies available:<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>var batchQuantity = 37;\nvar pack = 5;\nvar packsMade = batchQuantity \/ pack;\nconsole.log(\"You can make \", Math.floor(packsMade), \"packs of cookies.\");\nvar remainder = batchQuantity % pack;\nconsole.log(\"You'll have \", remainder, \" cookies left over.\");<\/pre><\/div>\n\n\n\n<p>Our code returns:<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>You can make 7 packs of cookies.\nYou'll have 2 cookies left over.<\/pre><\/div>\n\n\n\n<p>We\u2019ve made a couple of modifications to our code. First, we have rounded the value of <code>packsMade<\/code> down to the nearest whole number. We used <code>Math.floor()<\/code> for this purpose. This allows us to see that we can make 7 full packs of cookies.&nbsp;<br><\/p>\n\n\n\n<p>Then we used the modulo operator to calculate the remaining cookies that would be left over. This tells us that, after dividing our packs, we will have two cookies remaining.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Power<\/h2>\n\n\n\n<p>Raise x to the power of y. It sounds quite complicated, especially when you start using words like exponentiation. But it doesn&#8217;t have to be difficult.&nbsp;<br><\/p>\n\n\n\n<p>In JavaScript, two asterisks (**) represents raising a number to a power:<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>console.log(7 ** 3);<\/pre><\/div>\n\n\n\n<p>This code returns: <code>343<\/code>.<br><\/p>\n\n\n\n<p>This is another way of writing 7 * 7 * 7, but it is shorter and easier to read.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Order of Operations<\/h2>\n\n\n\n<p>Math has a specific order of operations. This describes what operations you should perform in what order when you\u2019re presented with a math problem.<br><\/p>\n\n\n\n<p>One of the most common ways to remember this order is BODMAS:<br><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>B<\/strong>rackets (())<\/li>\n\n\n\n<li><strong>O<\/strong>rder (power)<\/li>\n\n\n\n<li><strong>D<\/strong>ivision<\/li>\n\n\n\n<li><strong>M<\/strong>ultiplication<\/li>\n\n\n\n<li><strong>A<\/strong>ddition<\/li>\n\n\n\n<li><strong>S<\/strong>ubtraction<\/li>\n<\/ul>\n\n\n\n<p>This tells us that we should do everything in brackets first, then all the power calculations, then division, and so on. Consider the following problem:<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>var problem = (5 * 3) + 2;\nconsole.log(problem);<\/pre><\/div>\n\n\n\n<p>The answer to this problem is: 17. JavaScript first calculates 5 * 3 because it is in brackets. Then it adds two to the result of that calculation.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Conclusion<\/h2>\n\n\n\n<p>JavaScript offers a range of arithmetic operators that you can use to perform mathematical operations. Some of these operators, like addition, are the same as what we would use when evaluating a math problem; others have their own symbols.<br><\/p>\n\n\n\n<p>Remember that when you evaluate a math problem you need to consider BODMAS, the order of operations in which the problem will be read.<br><\/p>\n\n\n\n<p>Now you\u2019re ready to start doing math in JavaScript like a pro!<\/p>\n","protected":false},"excerpt":{"rendered":"Computers are really good at math. It\u2019s in their metaphorical blood, considering computers are powered by the 1s and 0s that we call binary. When you\u2019re coding, there\u2019s probably going to be a time when you want to perform some mathematical operation. In JavaScript, math comes up all the time. You can use math to&hellip;","protected":false},"author":240,"featured_media":18526,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[11933],"tags":[],"class_list":{"0":"post-18702","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.0 (Yoast SEO v27.0) - https:\/\/yoast.com\/product\/yoast-seo-premium-wordpress\/ -->\n<title>JavaScript Math: A Guide for Beginners | Career Karma<\/title>\n<meta name=\"description\" content=\"Mathematical operators allow you to perform math in JavaScript. On Career Karma, learn how to use six JavaScript mathematical operators.\" \/>\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-math\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"JavaScript Math: A Guide for Beginners\" \/>\n<meta property=\"og:description\" content=\"Mathematical operators allow you to perform math in JavaScript. On Career Karma, learn how to use six JavaScript mathematical operators.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/careerkarma.com\/blog\/javascript-math\/\" \/>\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-06-30T19:38:10+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2023-12-01T11:36:58+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/06\/zan-0WzeC6JtbHU-unsplash.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"1020\" \/>\n\t<meta property=\"og:image:height\" content=\"680\" \/>\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-math\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/careerkarma.com\/blog\/javascript-math\/\"},\"author\":{\"name\":\"James Gallagher\",\"@id\":\"https:\/\/careerkarma.com\/blog\/#\/schema\/person\/e79364792443fbff794a144c67ec8e94\"},\"headline\":\"JavaScript Math: A Guide for Beginners\",\"datePublished\":\"2020-06-30T19:38:10+00:00\",\"dateModified\":\"2023-12-01T11:36:58+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/careerkarma.com\/blog\/javascript-math\/\"},\"wordCount\":1007,\"commentCount\":0,\"image\":{\"@id\":\"https:\/\/careerkarma.com\/blog\/javascript-math\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/06\/zan-0WzeC6JtbHU-unsplash.jpg\",\"articleSection\":[\"JavaScript\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/careerkarma.com\/blog\/javascript-math\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/careerkarma.com\/blog\/javascript-math\/\",\"url\":\"https:\/\/careerkarma.com\/blog\/javascript-math\/\",\"name\":\"JavaScript Math: A Guide for Beginners | Career Karma\",\"isPartOf\":{\"@id\":\"https:\/\/careerkarma.com\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/careerkarma.com\/blog\/javascript-math\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/careerkarma.com\/blog\/javascript-math\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/06\/zan-0WzeC6JtbHU-unsplash.jpg\",\"datePublished\":\"2020-06-30T19:38:10+00:00\",\"dateModified\":\"2023-12-01T11:36:58+00:00\",\"author\":{\"@id\":\"https:\/\/careerkarma.com\/blog\/#\/schema\/person\/e79364792443fbff794a144c67ec8e94\"},\"description\":\"Mathematical operators allow you to perform math in JavaScript. On Career Karma, learn how to use six JavaScript mathematical operators.\",\"breadcrumb\":{\"@id\":\"https:\/\/careerkarma.com\/blog\/javascript-math\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/careerkarma.com\/blog\/javascript-math\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/careerkarma.com\/blog\/javascript-math\/#primaryimage\",\"url\":\"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/06\/zan-0WzeC6JtbHU-unsplash.jpg\",\"contentUrl\":\"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/06\/zan-0WzeC6JtbHU-unsplash.jpg\",\"width\":1020,\"height\":680},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/careerkarma.com\/blog\/javascript-math\/#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 Math: A Guide for Beginners\"}]},{\"@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\/#\/schema\/person\/image\/\",\"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 Math: A Guide for Beginners | Career Karma","description":"Mathematical operators allow you to perform math in JavaScript. On Career Karma, learn how to use six JavaScript mathematical operators.","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-math\/","og_locale":"en_US","og_type":"article","og_title":"JavaScript Math: A Guide for Beginners","og_description":"Mathematical operators allow you to perform math in JavaScript. On Career Karma, learn how to use six JavaScript mathematical operators.","og_url":"https:\/\/careerkarma.com\/blog\/javascript-math\/","og_site_name":"Career Karma","article_publisher":"http:\/\/facebook.com\/careerkarmaapp","article_published_time":"2020-06-30T19:38:10+00:00","article_modified_time":"2023-12-01T11:36:58+00:00","og_image":[{"width":1020,"height":680,"url":"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/06\/zan-0WzeC6JtbHU-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-math\/#article","isPartOf":{"@id":"https:\/\/careerkarma.com\/blog\/javascript-math\/"},"author":{"name":"James Gallagher","@id":"https:\/\/careerkarma.com\/blog\/#\/schema\/person\/e79364792443fbff794a144c67ec8e94"},"headline":"JavaScript Math: A Guide for Beginners","datePublished":"2020-06-30T19:38:10+00:00","dateModified":"2023-12-01T11:36:58+00:00","mainEntityOfPage":{"@id":"https:\/\/careerkarma.com\/blog\/javascript-math\/"},"wordCount":1007,"commentCount":0,"image":{"@id":"https:\/\/careerkarma.com\/blog\/javascript-math\/#primaryimage"},"thumbnailUrl":"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/06\/zan-0WzeC6JtbHU-unsplash.jpg","articleSection":["JavaScript"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/careerkarma.com\/blog\/javascript-math\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/careerkarma.com\/blog\/javascript-math\/","url":"https:\/\/careerkarma.com\/blog\/javascript-math\/","name":"JavaScript Math: A Guide for Beginners | Career Karma","isPartOf":{"@id":"https:\/\/careerkarma.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/careerkarma.com\/blog\/javascript-math\/#primaryimage"},"image":{"@id":"https:\/\/careerkarma.com\/blog\/javascript-math\/#primaryimage"},"thumbnailUrl":"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/06\/zan-0WzeC6JtbHU-unsplash.jpg","datePublished":"2020-06-30T19:38:10+00:00","dateModified":"2023-12-01T11:36:58+00:00","author":{"@id":"https:\/\/careerkarma.com\/blog\/#\/schema\/person\/e79364792443fbff794a144c67ec8e94"},"description":"Mathematical operators allow you to perform math in JavaScript. On Career Karma, learn how to use six JavaScript mathematical operators.","breadcrumb":{"@id":"https:\/\/careerkarma.com\/blog\/javascript-math\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/careerkarma.com\/blog\/javascript-math\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/careerkarma.com\/blog\/javascript-math\/#primaryimage","url":"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/06\/zan-0WzeC6JtbHU-unsplash.jpg","contentUrl":"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/06\/zan-0WzeC6JtbHU-unsplash.jpg","width":1020,"height":680},{"@type":"BreadcrumbList","@id":"https:\/\/careerkarma.com\/blog\/javascript-math\/#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 Math: A Guide for Beginners"}]},{"@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\/#\/schema\/person\/image\/","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\/18702","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=18702"}],"version-history":[{"count":0,"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/posts\/18702\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/media\/18526"}],"wp:attachment":[{"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/media?parent=18702"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/categories?post=18702"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/tags?post=18702"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}