{"id":23830,"date":"2020-10-07T11:38:41","date_gmt":"2020-10-07T18:38:41","guid":{"rendered":"https:\/\/careerkarma.com\/blog\/?p=23830"},"modified":"2020-12-29T12:43:06","modified_gmt":"2020-12-29T20:43:06","slug":"higher-order-functions","status":"publish","type":"post","link":"https:\/\/careerkarma.com\/blog\/higher-order-functions\/","title":{"rendered":"Higher Order Functions in JavaScript: A Guide"},"content":{"rendered":"\n<p>As a developer, you have likely used regular JavaScript functions. Called first order functions,&nbsp; they don\u2019t take in a function as a parameter or return a function.<br><\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>function hello(name) {\n   return &quot;Hello,&quot; + &quot; &quot; +  name\n}\n \nconsole.log(hello(&quot;Career Karma&quot;)); \/\/ Hello, Career Karma<\/pre><\/div>\n\n\n\n<p>This article talks about higher order functions (HOF). These are functions that help developers pare down code to make it more readable by passing in a function as an argument or by returning a function. We\u2019ll go over some basic examples to introduce you to HOF and functional programming and talk about two popular advanced array methods that make use of the higher order function construct to work.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Basic Higher Order Function Examples<\/h2>\n\n\n\n<p>There are several different ways to use Higher Order Functions in JavaScript.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Calculator<\/h3>\n\n\n\n<p>Let\u2019s start with a basic HOF that takes in a callback function as an argument and returns that callback with some arguments:&nbsp;<br><\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>\/\/higher order function\nfunction higherOrderFunction(num1, num2, cb) {\n   return cb(num1, num2); \/\/this invokes our cb function and passes in our arguments to the callback. \n}\n \n\/\/callbacks\nfunction add(num1, num2) {\n   return num1 + num2;\n}\nfunction multiply(num1, num2) {\n   return num1 * num2;\n}\nfunction divide(num1, num2) {\n   return num1\/num2;\n}\nfunction subtract(num1, num2) {\n   return num1 - num2;\n}\nfunction modulo(num1, num2) {\n   return num1 % num2;\n}\n \nconsole.log(higherOrderFunction(43, 13, add));<\/pre><\/div>\n\n\n\n<p>Here we have two types of functions: a higher order function that returns a callback and a set first order function that performs an operation on two numbers. At the end of the snippet, we make a function call to <code>higherOrderFunction()<\/code>. This function returns the result of an invocation of the cb that was passed in with the given parameters. If you\u2019ve written a callback function for all the possible arithmetic operators, you can use the higherOrderFunction to call whichever operation you need.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Event Listener<\/h3>\n\n\n\n<p>Another example of a higher order function is what occurs when you add an event listener to an element on the DOM (document object model). Take this example:&nbsp;<br><\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>&lt;!DOCTYPE html&gt;\n&lt;html&gt;\n   &lt;head&gt;\n       &lt;meta charset=&quot;utf-8&quot;&gt;\n       &lt;meta http-equiv=&quot;X-UA-Compatible&quot; content=&quot;IE=edge&quot;&gt;\n       &lt;title&gt;&lt;\/title&gt;\n       &lt;meta name=&quot;description&quot; content=&quot;&quot;&gt;\n       &lt;meta name=&quot;viewport&quot; content=&quot;width=device-width, initial-scale=1&quot;&gt;\n       &lt;link rel=&quot;stylesheet&quot; href=&quot;&quot;&gt;\n   &lt;\/head&gt;\n   &lt;body&gt;\n       &lt;!--[if lt IE 7]&gt;\n           &lt;p class=&quot;browsehappy&quot;&gt;You are using an &lt;strong&gt;outdated&lt;\/strong&gt; browser. Please &lt;a href=&quot;#&quot;&gt;upgrade your browser&lt;\/a&gt; to improve your experience.&lt;\/p&gt;\n       &lt;![endif]--&gt;\n       &lt;button&gt;Click Me!&lt;\/button&gt;\n       &lt;script async defer&gt;\n           const button = document.querySelector(&quot;button&quot;);\n           button.addEventListener(&quot;click&quot;, (e) =&gt; {\n               alert(&quot;The button has been clicked!&quot;);\n           })\n \n       &lt;\/script&gt;\n   &lt;\/body&gt;\n&lt;\/html&gt;<\/pre><\/div>\n\n\n\n<p>In this example, I created a button in HTML, selected it using JavaScript, and added an event listener to it. The structure of the event listener is that of a simple higher order function \u2013 it takes in an anonymous function as its second argument.<br><\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/lh5.googleusercontent.com\/WApl76f_jLixD4CcDdsm_GzldHGAB_HeFJ-brddwUzKakwRgAZwh4yzmcaVDsULX6Tu3ydkumGdIB_UkzasG7GDu-YjU45kY7MSGP1RPfgmAiGWetmHx9I0TcHFBIoiZRlii_bpq\" alt=\"Highlighted area that shows where the higher order function is in an event listener.\"\/><\/figure>\n\n\n\n<p>The highlighted section is your higher order function.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Advanced Array Methods<\/h2>\n\n\n\n<p>JavaScript Built-In Array Methods are those special higher order functions new to ES6 we can use to iterate over an array and either manipulate it or return an entirely new array whose values have been manipulated.&nbsp;<br><\/p>\n\n\n\n<p>As we start to get into more complex problem solving in JavaScript, start thinking about abstracting some of the logic we write when we iterate over arrays. Using these higher order function array methods helps you to become a better JS developer.<br><\/p>\n\n\n\n<p>Let\u2019s say for instance we have an array of professors:<br><\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/lh4.googleusercontent.com\/uVNRam00sqZ2XWlWgK36aj3tP7oHL2i1wM3JLEDbcqwXs-iBMxRNlmbknHgjO_JFy32VHF7u4glA1btMETcPhCPyoZ0GuToxG0D7MlPWlNMaWsRUNJtkMRNP4kPAYBdORaCwWiRF\" alt=\"\"\/><\/figure>\n\n\n\n<p><\/p>\n\n\n\n<h3 class=\"wp-block-heading\">forEach<\/h3>\n\n\n\n<p>If we want to iterate over the array and manipulate each item prior to using ES6, this is what we have to do:<br><\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>function forEachES5(arr){\n   for(let i = 0; i &lt; arr.length; i++) {\n       arr[i] = &quot;Professor &quot; + arr[i];\n   }\n   return arr;\n}\n \nconsole.log(forEachES5(professors));<\/pre><\/div>\n\n\n\n<p>ES6 syntax allows us to pare down the code by using the forEach method:<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>function forEachES6(arr) {\n   arr.forEach((professor, index, origArr) =&gt; {\n       origArr[index] = &quot;Professor &quot; + professor;\n   });\n   return arr;\n \n}<\/pre><\/div>\n\n\n\n<p>This forEach method takes in a callback function as its first parameter to make it a higher order function. This callback function is basically the \u201caction\u201d performed on each item that is in the array. In addition, the forEach method also takes in an index and an array as its optional second and third parameters.&nbsp;<br><\/p>\n\n\n\n<p>Order matters on these parameters in the forEach method (as well as the other built-in array methods). The first is always the callback function, the second is always the index of the item in the array, and the third is always a copy of the array itself.<br><\/p>\n\n\n\n<p>The forEach method is another way to present a for loop in JavaScript. It doesn\u2019t return anything. The method manipulates what\u2019s already there and saves it into the array you are working with if you specify what you want to do with it.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Map<\/h3>\n\n\n\n<p>The closest method to the forEach method is the map method. It works very much the same way, except this method returns a new array. Anything you manipulate in the callback function will not affect the original array.<br><\/p>\n\n\n\n<p>Let&#8217;s take a look at what map used to look like pre-ES6:<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>function mapES5(arr){\n   let newArr = [];\n   for(let i = 0; i &lt; arr.length; i++) {\n       newArr.push(&quot;Professor &quot; + arr[i]);\n   }\n   return newArr;\n}<\/pre><\/div>\n\n\n\n<p>As you can see, what we had to do was instantiate a new array outside our for loop so we can push new values to it. Then we actually have to return our new array to actually be able to use it elsewhere!<br><\/p>\n\n\n\n<p>With ES6 and the map method, we can abstract away some of that logic to make it more readable:<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>function mapWithES6(arr) {\n   const mapped = arr.map(professor =&gt; {\n       return &quot;Professor &quot; + professor;\n   })\n   return mapped;\n}<\/pre><\/div>\n\n\n\n<p>The special feature about the map method as well as other array methods like it, reduce and filter function in particular, is you can assign it to a variable and return it or just return the whole function altogether! No pushing is needed to a new array \u2013 it\u2019s done for you with this map method. Remember to have a return value in the logic inside your map method callback function!<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Conclusion:<\/h2>\n\n\n\n<p>Higher Order Functions are an extremely important concept in JavaScript to help you become a better developer. It\u2019ll help to abstract away some logic to make your code more readable, and, in some cases, more performant.<br><\/p>\n\n\n\n<p>In this tutorial, we explored some of the different ways we can write Higher Order Functions, from basic calculator methods to event listeners and advanced array functions. Once you have mastered this, you\u2019re ready to tackle some more complex solutions to problems!<\/p>\n","protected":false},"excerpt":{"rendered":"As a developer, you have likely used regular JavaScript functions. Called first order functions,&nbsp; they don\u2019t take in a function as a parameter or return a function. function hello(name) { return &quot;Hello,&quot; + &quot; &quot; + name } console.log(hello(&quot;Career Karma&quot;)); \/\/ Hello, Career Karma This article talks about higher order functions (HOF). These are functions&hellip;","protected":false},"author":77,"featured_media":23831,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[11933],"tags":[],"class_list":{"0":"post-23830","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>Higher Order Functions in JavaScript: A Guide | Career Karma<\/title>\n<meta name=\"description\" content=\"Higher Order Functions in JavaScript can be tricky at first. Learn how they work in this article by Career Karma!\" \/>\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\/higher-order-functions\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Higher Order Functions in JavaScript: A Guide\" \/>\n<meta property=\"og:description\" content=\"Higher Order Functions in JavaScript can be tricky at first. Learn how they work in this article by Career Karma!\" \/>\n<meta property=\"og:url\" content=\"https:\/\/careerkarma.com\/blog\/higher-order-functions\/\" \/>\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-10-07T18:38:41+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2020-12-29T20:43:06+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/10\/pexels-cottonbro-5474295.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=\"Christina Kopecky\" \/>\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=\"Christina Kopecky\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"6 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/higher-order-functions\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/higher-order-functions\\\/\"},\"author\":{\"name\":\"Christina Kopecky\",\"@id\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/#\\\/schema\\\/person\\\/ae0cdc4a5d198690d78482646894074e\"},\"headline\":\"Higher Order Functions in JavaScript: A Guide\",\"datePublished\":\"2020-10-07T18:38:41+00:00\",\"dateModified\":\"2020-12-29T20:43:06+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/higher-order-functions\\\/\"},\"wordCount\":858,\"commentCount\":0,\"image\":{\"@id\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/higher-order-functions\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/wp-content\\\/uploads\\\/2020\\\/10\\\/pexels-cottonbro-5474295.jpg\",\"articleSection\":[\"JavaScript\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/careerkarma.com\\\/blog\\\/higher-order-functions\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/higher-order-functions\\\/\",\"url\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/higher-order-functions\\\/\",\"name\":\"Higher Order Functions in JavaScript: A Guide | Career Karma\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/higher-order-functions\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/higher-order-functions\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/wp-content\\\/uploads\\\/2020\\\/10\\\/pexels-cottonbro-5474295.jpg\",\"datePublished\":\"2020-10-07T18:38:41+00:00\",\"dateModified\":\"2020-12-29T20:43:06+00:00\",\"author\":{\"@id\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/#\\\/schema\\\/person\\\/ae0cdc4a5d198690d78482646894074e\"},\"description\":\"Higher Order Functions in JavaScript can be tricky at first. Learn how they work in this article by Career Karma!\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/higher-order-functions\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/careerkarma.com\\\/blog\\\/higher-order-functions\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/higher-order-functions\\\/#primaryimage\",\"url\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/wp-content\\\/uploads\\\/2020\\\/10\\\/pexels-cottonbro-5474295.jpg\",\"contentUrl\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/wp-content\\\/uploads\\\/2020\\\/10\\\/pexels-cottonbro-5474295.jpg\",\"width\":1020,\"height\":680,\"caption\":\"Hands on laptop keyboard\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/higher-order-functions\\\/#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\":\"Higher Order Functions in JavaScript: 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\\\/ae0cdc4a5d198690d78482646894074e\",\"name\":\"Christina Kopecky\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/wp-content\\\/uploads\\\/2020\\\/06\\\/image-3-150x150.jpg\",\"url\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/wp-content\\\/uploads\\\/2020\\\/06\\\/image-3-150x150.jpg\",\"contentUrl\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/wp-content\\\/uploads\\\/2020\\\/06\\\/image-3-150x150.jpg\",\"caption\":\"Christina Kopecky\"},\"description\":\"Christina is an experienced technical writer, covering topics as diverse as Java, SQL, Python, and web development. She earned her Master of Music in flute performance from the University of Kansas and a bachelor's degree in music with minors in French and mass communication from Southeast Missouri State. Prior to joining the Career Karma team in June 2020, Christina was a teaching assistant, team lead, and section lead at Lambda School, where she led student groups, performed code and project reviews, and debugged problems for students. Christina's technical content is featured frequently in publications like Codecademy, Repl.it, and Educative.\",\"sameAs\":[\"http:\\\/\\\/www.linkedin.com\\\/in\\\/cmvnk\"],\"url\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/author\\\/christina-kopecky\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"Higher Order Functions in JavaScript: A Guide | Career Karma","description":"Higher Order Functions in JavaScript can be tricky at first. Learn how they work in this article by Career Karma!","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\/higher-order-functions\/","og_locale":"en_US","og_type":"article","og_title":"Higher Order Functions in JavaScript: A Guide","og_description":"Higher Order Functions in JavaScript can be tricky at first. Learn how they work in this article by Career Karma!","og_url":"https:\/\/careerkarma.com\/blog\/higher-order-functions\/","og_site_name":"Career Karma","article_publisher":"http:\/\/facebook.com\/careerkarmaapp","article_published_time":"2020-10-07T18:38:41+00:00","article_modified_time":"2020-12-29T20:43:06+00:00","og_image":[{"width":1020,"height":680,"url":"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/10\/pexels-cottonbro-5474295.jpg","type":"image\/jpeg"}],"author":"Christina Kopecky","twitter_card":"summary_large_image","twitter_creator":"@career_karma","twitter_site":"@career_karma","twitter_misc":{"Written by":"Christina Kopecky","Est. reading time":"6 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/careerkarma.com\/blog\/higher-order-functions\/#article","isPartOf":{"@id":"https:\/\/careerkarma.com\/blog\/higher-order-functions\/"},"author":{"name":"Christina Kopecky","@id":"https:\/\/careerkarma.com\/blog\/#\/schema\/person\/ae0cdc4a5d198690d78482646894074e"},"headline":"Higher Order Functions in JavaScript: A Guide","datePublished":"2020-10-07T18:38:41+00:00","dateModified":"2020-12-29T20:43:06+00:00","mainEntityOfPage":{"@id":"https:\/\/careerkarma.com\/blog\/higher-order-functions\/"},"wordCount":858,"commentCount":0,"image":{"@id":"https:\/\/careerkarma.com\/blog\/higher-order-functions\/#primaryimage"},"thumbnailUrl":"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/10\/pexels-cottonbro-5474295.jpg","articleSection":["JavaScript"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/careerkarma.com\/blog\/higher-order-functions\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/careerkarma.com\/blog\/higher-order-functions\/","url":"https:\/\/careerkarma.com\/blog\/higher-order-functions\/","name":"Higher Order Functions in JavaScript: A Guide | Career Karma","isPartOf":{"@id":"https:\/\/careerkarma.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/careerkarma.com\/blog\/higher-order-functions\/#primaryimage"},"image":{"@id":"https:\/\/careerkarma.com\/blog\/higher-order-functions\/#primaryimage"},"thumbnailUrl":"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/10\/pexels-cottonbro-5474295.jpg","datePublished":"2020-10-07T18:38:41+00:00","dateModified":"2020-12-29T20:43:06+00:00","author":{"@id":"https:\/\/careerkarma.com\/blog\/#\/schema\/person\/ae0cdc4a5d198690d78482646894074e"},"description":"Higher Order Functions in JavaScript can be tricky at first. Learn how they work in this article by Career Karma!","breadcrumb":{"@id":"https:\/\/careerkarma.com\/blog\/higher-order-functions\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/careerkarma.com\/blog\/higher-order-functions\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/careerkarma.com\/blog\/higher-order-functions\/#primaryimage","url":"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/10\/pexels-cottonbro-5474295.jpg","contentUrl":"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/10\/pexels-cottonbro-5474295.jpg","width":1020,"height":680,"caption":"Hands on laptop keyboard"},{"@type":"BreadcrumbList","@id":"https:\/\/careerkarma.com\/blog\/higher-order-functions\/#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":"Higher Order Functions in JavaScript: 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\/ae0cdc4a5d198690d78482646894074e","name":"Christina Kopecky","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/06\/image-3-150x150.jpg","url":"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/06\/image-3-150x150.jpg","contentUrl":"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/06\/image-3-150x150.jpg","caption":"Christina Kopecky"},"description":"Christina is an experienced technical writer, covering topics as diverse as Java, SQL, Python, and web development. She earned her Master of Music in flute performance from the University of Kansas and a bachelor's degree in music with minors in French and mass communication from Southeast Missouri State. Prior to joining the Career Karma team in June 2020, Christina was a teaching assistant, team lead, and section lead at Lambda School, where she led student groups, performed code and project reviews, and debugged problems for students. Christina's technical content is featured frequently in publications like Codecademy, Repl.it, and Educative.","sameAs":["http:\/\/www.linkedin.com\/in\/cmvnk"],"url":"https:\/\/careerkarma.com\/blog\/author\/christina-kopecky\/"}]}},"_links":{"self":[{"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/posts\/23830","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\/77"}],"replies":[{"embeddable":true,"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/comments?post=23830"}],"version-history":[{"count":0,"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/posts\/23830\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/media\/23831"}],"wp:attachment":[{"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/media?parent=23830"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/categories?post=23830"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/tags?post=23830"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}