{"id":18691,"date":"2020-06-30T10:09:54","date_gmt":"2020-06-30T17:09:54","guid":{"rendered":"https:\/\/careerkarma.com\/blog\/?p=18691"},"modified":"2023-12-01T03:36:44","modified_gmt":"2023-12-01T11:36:44","slug":"javascript-default-parameters","status":"publish","type":"post","link":"https:\/\/careerkarma.com\/blog\/javascript-default-parameters\/","title":{"rendered":"JavaScript Default Parameters: A Beginner&#8217;s Guide"},"content":{"rendered":"\n<p>Default parameters make working with functions a whole lot easier. Using default parameters, you can tell your functions what parameters they should use in the case that you haven\u2019t specified any. This can help avoid errors and makes your code more readable.<br><\/p>\n\n\n\n<p>JavaScript introduced default parameters in ES2015. These allow you to initialize a function with predefined values.<br><\/p>\n\n\n\n<p>In this guide, we\u2019re going to talk about what default parameters are, how you can use them, and what types of expressions you can specify as a default parameter. We\u2019ll walk through a few examples so that you\u2019ll have all the code you need to get started.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Parameters vs. Arguments: The Battle<\/h2>\n\n\n\n<p>Before we begin, let\u2019s address an age-old question from beginners: what is the difference between a parameter and an argument? You need to know the difference before you start working with default parameters in JavaScript.<br><\/p>\n\n\n\n<p>A parameter is a named variable that you pass into a JavaScript function. A parameter never has a direct value assigned to it. It is a placeholder for a value you are going to pass into a function. Here\u2019s an example of a parameter:<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>function sayHello(name) {\n\tconsole.log(\"Hello, \" + name);\n}<\/pre><\/div>\n\n\n\n<p>In this example, \u201cname\u201d is our parameter. It doesn\u2019t have any value assigned to it.<br><\/p>\n\n\n\n<p>Arguments, on the other hand, are values that are passed to a function:<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>sayHello(\"Brett\");<\/pre><\/div>\n\n\n\n<p>Our code returns: \u201cHello, Brett\u201d. \u201cBrett\u201d is an example of an argument, which was the value we passed through our function.<br><\/p>\n\n\n\n<p>Calling a function without specifying all of its parameters can lead to an error:<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>sayHello()<\/pre><\/div>\n\n\n\n<p>Our code returns: <code>Hello, undefined<\/code>. That\u2019s because we haven\u2019t passed a value to our function.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">JavaScript Default Parameters<\/h2>\n\n\n\n<p>We can overcome this problem by specifying a default parameter. A default parameter allows you to specify a value that will be assigned to a parameter in the case that none is specified.<br><\/p>\n\n\n\n<p>Default value assignment uses the assignment operator:<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>function sayHello(name=\"World\") {\n\tconsole.log(\"Hello, \" + name);\n}\nsayHello();<\/pre><\/div>\n\n\n\n<p>Our code returns: <code>Hello, World<\/code>. You can see that we\u2019ve not specified an argument in this example. Instead, we\u2019ve set a default function parameter. In this case, any time an argument is not specified, the value of the \u201cname\u201d parameter in our function becomes \u201cWorld\u201d.<br><\/p>\n\n\n\n<p>This is much easier than having to check manually for whether a value is specified.<br><\/p>\n\n\n\n<p>A default parameter can have any primitive value or object assigned as its value. Here are a few examples of valid default parameters:<br><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>String: \u201cLatte\u201d<\/li>\n\n\n\n<li>Number: 2.40<\/li>\n\n\n\n<li>Boolean: true<\/li>\n\n\n\n<li>Array: [\u201cSteven\u201d, false]<\/li>\n\n\n\n<li>Object: {name: \u201cSteven\u201d, loyaltyCustomer: false }<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">Specifying Multiple Default Parameters<\/h2>\n\n\n\n<p>There\u2019s no limit on how many default params you can specify in a function. Consider the following code:<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>function createOrder(coffee=\"Espresso\", price=1.75) {\n\tconsole.log(\"Order: \" + coffee);\n\tconsole.log(\"Price: $\" + price);\n}\ncreateOrder();<\/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>Order: Espresso\nPrice: $1.75<\/pre><\/div>\n\n\n\n<p>In this example, we\u2019ve specified two default parameters: coffee and price. You can also mix up the parameters you specify between default and regular parameters. When you do this, you\u2019ve got to place any regular parameters before default parameters. Consider this example:<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>function createOrder(coffee, price=1.75) {\n\tconsole.log(\"Order: \" + coffee);\n\tconsole.log(\"Price: $\" + price);\n}\ncreateOrder(\"Cappuccino\");<\/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>Order: Cappuccino\nPrice: $1.75<\/pre><\/div>\n\n\n\n<p>We\u2019ve specified one argument: Cappuccino. This is the name of the coffee that we have ordered. Because we haven\u2019t specified a default value for this parameter, we need to specify an argument value; otherwise, \u201cundefined\u201d would be returned.<br><\/p>\n\n\n\n<p>We declared that the default value for \u201cprice\u201d should be \u201c1.75\u201d. Because we set this default parameter, any time we don\u2019t specify a price it will be automatically set to \u201c1.75\u201d.<br><\/p>\n\n\n\n<p>It\u2019s important that you specify any regular parameters before your default parameters. This is because the values for regular parameters are assigned in order of when they appear in your function call.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Functions as a Default Parameter<\/h2>\n\n\n\n<p>A function can be set as a default parameter. This is useful if the value you want to pass into a function is calculated using another function.<br><\/p>\n\n\n\n<p>In the following code snippet, we\u2019re going to create a function that generates a pseudo-random username for a new player on a video game:<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>function getRandomUsername() {\n\tvar number = Math.floor(Math.random() * 100);\n\tvar username_list = ['Crash', 'Steve', 'Lucinda', 'Ellie'];\n\tvar username = username_list[Math.floor(Math.random() * username_list.length)];\n\tvar final_username = username + number;\n\treturn final_username;\n}\nfunction createUser(username = getRandomUsername(), email) {\n\tconsole.log('Your username is: ' + username);\n\tconsole.log('Your email is: ' + email);\n}\ncreateUser('test@test.com');<\/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>Your username is: Crash87\nYour email is: test@test.com<\/pre><\/div>\n\n\n\n<p>Let\u2019s break down our code.<br><\/p>\n\n\n\n<p>We have declared a function called <code>getRandomUsername()<\/code> which generates a pseudo-random username. This works by generating a random number and selecting, at random, one username from a list of four usernames. The random number is then added to the end of the username. This function returns the newly-generated username<br><\/p>\n\n\n\n<p>In our <code>createUser<\/code> function, we\u2019ve set the default value of the \u201cusername\u201d parameter to be equal to our <code>getRandomUsername()<\/code> function. This means that whenever we don\u2019t specify a username for our new user, a random one is generated.<br><\/p>\n\n\n\n<p>Our code then prints out the user\u2019s username as well as their email address to the console.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Conclusion<\/h2>\n\n\n\n<p>Default parameters allow you to set a value that will be assigned to a parameter if one is not specified as an argument in a function call. Default parameters help make your functions easier to read and reduce issues that may arise when a value is not passed to a function.<br><\/p>\n\n\n\n<p>Now you\u2019re ready to start working with JavaScript default parameters like an expert!<\/p>\n","protected":false},"excerpt":{"rendered":"Default parameters make working with functions a whole lot easier. Using default parameters, you can tell your functions what parameters they should use in the case that you haven\u2019t specified any. This can help avoid errors and makes your code more readable. JavaScript introduced default parameters in ES2015. These allow you to initialize a function&hellip;","protected":false},"author":240,"featured_media":18692,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[11933],"tags":[],"class_list":{"0":"post-18691","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 Default Parameters: A Beginner&#039;s Guide %<\/title>\n<meta name=\"description\" content=\"Default parameters allow you to specify a value that will be assigned to a parameter if none is assigned. On Career Karma, learn how to use default parameters.\" \/>\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-default-parameters\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"JavaScript Default Parameters: A Beginner&#039;s Guide\" \/>\n<meta property=\"og:description\" content=\"Default parameters allow you to specify a value that will be assigned to a parameter if none is assigned. On Career Karma, learn how to use default parameters.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/careerkarma.com\/blog\/javascript-default-parameters\/\" \/>\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-30T17:09:54+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2023-12-01T11:36:44+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/06\/pankaj-patel-Fi-GJaLRGKc-unsplash.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"1020\" \/>\n\t<meta property=\"og:image:height\" content=\"638\" \/>\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-default-parameters\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/javascript-default-parameters\\\/\"},\"author\":{\"name\":\"James Gallagher\",\"@id\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/#\\\/schema\\\/person\\\/e79364792443fbff794a144c67ec8e94\"},\"headline\":\"JavaScript Default Parameters: A Beginner&#8217;s Guide\",\"datePublished\":\"2020-06-30T17:09:54+00:00\",\"dateModified\":\"2023-12-01T11:36:44+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/javascript-default-parameters\\\/\"},\"wordCount\":832,\"commentCount\":0,\"image\":{\"@id\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/javascript-default-parameters\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/wp-content\\\/uploads\\\/2020\\\/06\\\/pankaj-patel-Fi-GJaLRGKc-unsplash.jpg\",\"articleSection\":[\"JavaScript\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/careerkarma.com\\\/blog\\\/javascript-default-parameters\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/javascript-default-parameters\\\/\",\"url\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/javascript-default-parameters\\\/\",\"name\":\"JavaScript Default Parameters: A Beginner's Guide %\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/javascript-default-parameters\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/javascript-default-parameters\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/wp-content\\\/uploads\\\/2020\\\/06\\\/pankaj-patel-Fi-GJaLRGKc-unsplash.jpg\",\"datePublished\":\"2020-06-30T17:09:54+00:00\",\"dateModified\":\"2023-12-01T11:36:44+00:00\",\"author\":{\"@id\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/#\\\/schema\\\/person\\\/e79364792443fbff794a144c67ec8e94\"},\"description\":\"Default parameters allow you to specify a value that will be assigned to a parameter if none is assigned. On Career Karma, learn how to use default parameters.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/javascript-default-parameters\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/careerkarma.com\\\/blog\\\/javascript-default-parameters\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/javascript-default-parameters\\\/#primaryimage\",\"url\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/wp-content\\\/uploads\\\/2020\\\/06\\\/pankaj-patel-Fi-GJaLRGKc-unsplash.jpg\",\"contentUrl\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/wp-content\\\/uploads\\\/2020\\\/06\\\/pankaj-patel-Fi-GJaLRGKc-unsplash.jpg\",\"width\":1020,\"height\":638},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/javascript-default-parameters\\\/#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 Default Parameters: A Beginner&#8217;s 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 Default Parameters: A Beginner's Guide %","description":"Default parameters allow you to specify a value that will be assigned to a parameter if none is assigned. On Career Karma, learn how to use default parameters.","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-default-parameters\/","og_locale":"en_US","og_type":"article","og_title":"JavaScript Default Parameters: A Beginner's Guide","og_description":"Default parameters allow you to specify a value that will be assigned to a parameter if none is assigned. On Career Karma, learn how to use default parameters.","og_url":"https:\/\/careerkarma.com\/blog\/javascript-default-parameters\/","og_site_name":"Career Karma","article_publisher":"http:\/\/facebook.com\/careerkarmaapp","article_published_time":"2020-06-30T17:09:54+00:00","article_modified_time":"2023-12-01T11:36:44+00:00","og_image":[{"width":1020,"height":638,"url":"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/06\/pankaj-patel-Fi-GJaLRGKc-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":"4 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/careerkarma.com\/blog\/javascript-default-parameters\/#article","isPartOf":{"@id":"https:\/\/careerkarma.com\/blog\/javascript-default-parameters\/"},"author":{"name":"James Gallagher","@id":"https:\/\/careerkarma.com\/blog\/#\/schema\/person\/e79364792443fbff794a144c67ec8e94"},"headline":"JavaScript Default Parameters: A Beginner&#8217;s Guide","datePublished":"2020-06-30T17:09:54+00:00","dateModified":"2023-12-01T11:36:44+00:00","mainEntityOfPage":{"@id":"https:\/\/careerkarma.com\/blog\/javascript-default-parameters\/"},"wordCount":832,"commentCount":0,"image":{"@id":"https:\/\/careerkarma.com\/blog\/javascript-default-parameters\/#primaryimage"},"thumbnailUrl":"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/06\/pankaj-patel-Fi-GJaLRGKc-unsplash.jpg","articleSection":["JavaScript"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/careerkarma.com\/blog\/javascript-default-parameters\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/careerkarma.com\/blog\/javascript-default-parameters\/","url":"https:\/\/careerkarma.com\/blog\/javascript-default-parameters\/","name":"JavaScript Default Parameters: A Beginner's Guide %","isPartOf":{"@id":"https:\/\/careerkarma.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/careerkarma.com\/blog\/javascript-default-parameters\/#primaryimage"},"image":{"@id":"https:\/\/careerkarma.com\/blog\/javascript-default-parameters\/#primaryimage"},"thumbnailUrl":"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/06\/pankaj-patel-Fi-GJaLRGKc-unsplash.jpg","datePublished":"2020-06-30T17:09:54+00:00","dateModified":"2023-12-01T11:36:44+00:00","author":{"@id":"https:\/\/careerkarma.com\/blog\/#\/schema\/person\/e79364792443fbff794a144c67ec8e94"},"description":"Default parameters allow you to specify a value that will be assigned to a parameter if none is assigned. On Career Karma, learn how to use default parameters.","breadcrumb":{"@id":"https:\/\/careerkarma.com\/blog\/javascript-default-parameters\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/careerkarma.com\/blog\/javascript-default-parameters\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/careerkarma.com\/blog\/javascript-default-parameters\/#primaryimage","url":"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/06\/pankaj-patel-Fi-GJaLRGKc-unsplash.jpg","contentUrl":"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/06\/pankaj-patel-Fi-GJaLRGKc-unsplash.jpg","width":1020,"height":638},{"@type":"BreadcrumbList","@id":"https:\/\/careerkarma.com\/blog\/javascript-default-parameters\/#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 Default Parameters: A Beginner&#8217;s 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\/18691","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=18691"}],"version-history":[{"count":0,"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/posts\/18691\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/media\/18692"}],"wp:attachment":[{"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/media?parent=18691"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/categories?post=18691"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/tags?post=18691"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}