{"id":154,"date":"2019-04-16T14:49:17","date_gmt":"2019-04-16T14:49:17","guid":{"rendered":"https:\/\/www.codemotion.com\/magazine\/the-what-why-and-how-of-javascript-functional-programming\/"},"modified":"2021-04-07T12:30:24","modified_gmt":"2021-04-07T10:30:24","slug":"the-what-why-and-how-of-javascript-functional-programming","status":"publish","type":"post","link":"https:\/\/www.codemotion.com\/magazine\/frontend\/web-developer\/the-what-why-and-how-of-javascript-functional-programming\/","title":{"rendered":"The what, why and how of Javascript functional programming"},"content":{"rendered":"<p>As programming geeks know, \u201cclassical\u201d <span id=\"urn:batch-analysis-c50eba5e-5d40-4c18-8428-748cb410c4ed\" class=\"textannotation disambiguated wl-no-link wl-other\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/programming_languages\">programming languages<\/span>, like <span id=\"urn:batch-analysis-d5f42443-ca26-4bf7-bffe-05e7f35c7d31\" class=\"textannotation disambiguated wl-no-link wl-other\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/c\">C<\/span>\/C++ and <span id=\"urn:batch-analysis-052d2730-e138-40e6-a1bb-0837d51c416a\" class=\"textannotation disambiguated wl-no-link wl-other\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/java\">Java<\/span>, are <strong>Imperative<\/strong>. This means you tell the computer how to do something and it does it. By contrast, functional languages are <strong>Declarative<\/strong> \u2013 you tell the computer the outcome you want. In his talk \u201c<a href=\"https:\/\/berlin2018.codemotionworld.com\/speaker\/4302\/\" target=\"_blank\" rel=\"noopener noreferrer\">JavaScript functional programming: our misunderstood friend<\/a>\u201d at Codemotion Berlin 2018, Matteo Hertel of Skyscanner told us how he learned to embrace functional programming (FP), and gave some nice examples of how to write functional JavaScript code.<\/p>\n<p>Matteo started off by explaining the difference between imperative and declarative code. His slides have a pretty gradient as a background. Using CSS (which is declarative), you just tell the render engine to set a gradient. Using imperative code, you would have to use for-loops to iterate through every pixel, setting the right colour each time.<\/p>\n<p>He went on to explain the key concepts underpinning FP:<\/p>\n<ul>\n<li><strong>Mappers<\/strong> convert an input into an output e.g. the <code>map() method<\/code><\/li>\n<li><strong>Predicates<\/strong> apply a test and return true or false e.g. the <code>filter() method<\/code><\/li>\n<li><strong>Reducers<\/strong> combine 2 values together e.g. the <code>reduce() method<\/code><\/li>\n<\/ul>\n<p>He then showed how these concepts can be used in JavaScript programming.<\/p>\n<h2>A simple example<\/h2>\n<p>I will use one of his examples to illustrate how you can convert imperative code into declarative code. Imagine you have a list of cities that you want to convert to upper-case. The following snippet of imperative code does this using a for-loop:<\/p>\n<p><script src=\"https:\/\/pastebin.com\/embed_js\/pqBxc38w\"><\/p>\n<\/p>\n<p>So, how can you do this in a functional style? The answer is to use <code>map()<\/code>, which will take each element in the original string and use <code>toUpperCase()<\/code> to make it upper-case:<\/p>\n<\/p>\n<p><script src=\"https:\/\/pastebin.com\/embed_js\/YkHa4LVk\"><\/script><\/p>\n<p>So, how can you do this in a functional style? The answer is to use <code>map()<\/code>, which will take each element in the original string and use <code>toUpperCase()<\/code> to make it upper-case:<\/p>\n<p><script src=\"https:\/\/pastebin.com\/embed_js\/YkHa4LVk\"><\/script><\/p>\n<p>But can you do better? Well, yes. Ideally, for testability, you want to move the upper-case functionality to a separate method which Matteo called <code>shout()<\/code>:<\/p>\n<p><script src=\"https:\/\/pastebin.com\/embed_js\/V8E3RjJD\"><\/script><\/p>\n<h2>Combining functions<\/h2>\n<p>The cool thing about FP is that you can start to chain functions together. The following snippet chains together a <code>filter()<\/code>, a <code>map()<\/code> and a <code>reduce()<\/code>, along with a function that removes Edinburgh from the list:<\/p>\n<p><script src=\"https:\/\/pastebin.com\/embed_js\/8jYs2PjZ\"><\/script><\/p>\n<p>But Matteo highlighted that this snippet uses lots of <strong>points<\/strong> \u2013 each function in the chain is calling the <code>city<\/code> parameter. This is seen as bad coding style, so he finished with a cleaner <a href=\"https:\/\/en.wikipedia.org\/wiki\/Tacit_programming\" target=\"_blank\" rel=\"noopener noreferrer\">point-free<\/a> version of the code, which can be read like a story:<\/p>\n<p><script src=\"https:\/\/pastebin.com\/embed_js\/w0L9GH1K\"><\/script><\/p>\n<h2>Using FP for real<\/h2>\n<p>When asked about combining <a href=\"https:\/\/www.codemotion.com\/magazine\/dev-hub\/backend-dev\/lsp-functional-programming\/\" target=\"_blank\" rel=\"noopener\">functional and imperative programming<\/a>, Matteo explained that JS makes it really easy to start using functional programming, since you can refactor your code a bit at a time. This is because <span id=\"urn:batch-analysis-ab5abca0-54a9-4034-8f6b-bbc72e143a36\" class=\"textannotation disambiguated wl-no-link wl-creative work\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/javascript\">JavaScript<\/span> was designed to allow functional and imperative <span id=\"urn:batch-analysis-af9430af-b32a-48de-9f4f-9e06fd16d1c7\" class=\"textannotation disambiguated wl-no-link wl-other\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/minification_programming\">programming<\/span> to be combined. Unlike pure functional languages (e.g. Haskell), JS allows for side effects (where something outside the scope of the function is modified).<\/p>\n<p>Matteo left us all feeling excited about functional <span id=\"urn:batch-analysis-361a29a8-cdbb-4fad-91cc-68768bd6d0ee\" class=\"textannotation disambiguated wl-no-link wl-other\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/minification_programming\">programming<\/span>, and suggested we check out Kyle Simpson\u2019s <a href=\"https:\/\/frontendmasters.com\/courses\/functional-javascript-v2\/\" target=\"_blank\" rel=\"noopener noreferrer\">FP course<\/a> on Frontend Masters. I, for one, will definitely give it a go!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>As programming geeks know, \u201cclassical\u201d programming languages, like C\/C++ and Java, are Imperative. This means you tell the computer how to do something and it does it. By contrast, functional languages are Declarative \u2013 you tell the computer the outcome you want. In his talk \u201cJavaScript functional programming: our misunderstood friend\u201d at Codemotion Berlin 2018,&#8230; <a class=\"more-link\" href=\"https:\/\/www.codemotion.com\/magazine\/frontend\/web-developer\/the-what-why-and-how-of-javascript-functional-programming\/\">Read more<\/a><\/p>\n","protected":false},"author":7,"featured_media":155,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_editorskit_title_hidden":false,"_editorskit_reading_time":0,"_editorskit_is_block_options_detached":false,"_editorskit_block_options_position":"{}","_uag_custom_page_level_css":"","_genesis_hide_title":false,"_genesis_hide_breadcrumbs":false,"_genesis_hide_singular_image":false,"_genesis_hide_footer_widgets":false,"_genesis_custom_body_class":"","_genesis_custom_post_class":"","_genesis_layout":"","footnotes":""},"categories":[31],"tags":[11],"collections":[],"class_list":{"0":"post-154","1":"post","2":"type-post","3":"status-publish","4":"format-standard","5":"has-post-thumbnail","7":"category-web-developer","8":"tag-codemotion-berlin","9":"entry"},"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v26.9 (Yoast SEO v26.9) - https:\/\/yoast.com\/product\/yoast-seo-premium-wordpress\/ -->\n<title>The what, why and how of Javascript functional programming - Codemotion Magazine<\/title>\n<meta name=\"description\" content=\"Codemotion and Facebook organized the Tech Leadership Training boot camp, heres a personal reportage from one of our attendees.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.codemotion.com\/magazine\/frontend\/web-developer\/the-what-why-and-how-of-javascript-functional-programming\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"The what, why and how of Javascript functional programming\" \/>\n<meta property=\"og:description\" content=\"Codemotion and Facebook organized the Tech Leadership Training boot camp, heres a personal reportage from one of our attendees.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.codemotion.com\/magazine\/frontend\/web-developer\/the-what-why-and-how-of-javascript-functional-programming\/\" \/>\n<meta property=\"og:site_name\" content=\"Codemotion Magazine\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/Codemotion.Italy\/\" \/>\n<meta property=\"article:published_time\" content=\"2019-04-16T14:49:17+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2021-04-07T10:30:24+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2019\/04\/1548b67007c16455b92f9b0e515fb6d0e50fb694.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"492\" \/>\n\t<meta property=\"og:image:height\" content=\"277\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Toby Moncaster\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:title\" content=\"The what, why and how of Javascript functional programming\" \/>\n<meta name=\"twitter:creator\" content=\"@tobym76\" \/>\n<meta name=\"twitter:site\" content=\"@CodemotionIT\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Toby Moncaster\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.codemotion.com\/magazine\/frontend\/web-developer\/the-what-why-and-how-of-javascript-functional-programming\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.codemotion.com\/magazine\/frontend\/web-developer\/the-what-why-and-how-of-javascript-functional-programming\/\"},\"author\":{\"name\":\"Toby Moncaster\",\"@id\":\"https:\/\/www.codemotion.com\/magazine\/#\/schema\/person\/8b9f025e7d76754fb3d4ffd428b0813b\"},\"headline\":\"The what, why and how of Javascript functional programming\",\"datePublished\":\"2019-04-16T14:49:17+00:00\",\"dateModified\":\"2021-04-07T10:30:24+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.codemotion.com\/magazine\/frontend\/web-developer\/the-what-why-and-how-of-javascript-functional-programming\/\"},\"wordCount\":479,\"publisher\":{\"@id\":\"https:\/\/www.codemotion.com\/magazine\/#organization\"},\"image\":{\"@id\":\"https:\/\/www.codemotion.com\/magazine\/frontend\/web-developer\/the-what-why-and-how-of-javascript-functional-programming\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2019\/04\/1548b67007c16455b92f9b0e515fb6d0e50fb694.jpg\",\"keywords\":[\"Codemotion Berlin\"],\"articleSection\":[\"Web Developer\"],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.codemotion.com\/magazine\/frontend\/web-developer\/the-what-why-and-how-of-javascript-functional-programming\/\",\"url\":\"https:\/\/www.codemotion.com\/magazine\/frontend\/web-developer\/the-what-why-and-how-of-javascript-functional-programming\/\",\"name\":\"The what, why and how of Javascript functional programming - Codemotion Magazine\",\"isPartOf\":{\"@id\":\"https:\/\/www.codemotion.com\/magazine\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.codemotion.com\/magazine\/frontend\/web-developer\/the-what-why-and-how-of-javascript-functional-programming\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/www.codemotion.com\/magazine\/frontend\/web-developer\/the-what-why-and-how-of-javascript-functional-programming\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2019\/04\/1548b67007c16455b92f9b0e515fb6d0e50fb694.jpg\",\"datePublished\":\"2019-04-16T14:49:17+00:00\",\"dateModified\":\"2021-04-07T10:30:24+00:00\",\"description\":\"Codemotion and Facebook organized the Tech Leadership Training boot camp, heres a personal reportage from one of our attendees.\",\"breadcrumb\":{\"@id\":\"https:\/\/www.codemotion.com\/magazine\/frontend\/web-developer\/the-what-why-and-how-of-javascript-functional-programming\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.codemotion.com\/magazine\/frontend\/web-developer\/the-what-why-and-how-of-javascript-functional-programming\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.codemotion.com\/magazine\/frontend\/web-developer\/the-what-why-and-how-of-javascript-functional-programming\/#primaryimage\",\"url\":\"https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2019\/04\/1548b67007c16455b92f9b0e515fb6d0e50fb694.jpg\",\"contentUrl\":\"https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2019\/04\/1548b67007c16455b92f9b0e515fb6d0e50fb694.jpg\",\"width\":492,\"height\":277},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.codemotion.com\/magazine\/frontend\/web-developer\/the-what-why-and-how-of-javascript-functional-programming\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.codemotion.com\/magazine\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Frontend\",\"item\":\"https:\/\/www.codemotion.com\/magazine\/frontend\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Web Developer\",\"item\":\"https:\/\/www.codemotion.com\/magazine\/frontend\/web-developer\/\"},{\"@type\":\"ListItem\",\"position\":4,\"name\":\"The what, why and how of Javascript functional programming\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.codemotion.com\/magazine\/#website\",\"url\":\"https:\/\/www.codemotion.com\/magazine\/\",\"name\":\"Codemotion Magazine\",\"description\":\"We code the future. Together\",\"publisher\":{\"@id\":\"https:\/\/www.codemotion.com\/magazine\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.codemotion.com\/magazine\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/www.codemotion.com\/magazine\/#organization\",\"name\":\"Codemotion\",\"url\":\"https:\/\/www.codemotion.com\/magazine\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.codemotion.com\/magazine\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2019\/11\/codemotionlogo.png\",\"contentUrl\":\"https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2019\/11\/codemotionlogo.png\",\"width\":225,\"height\":225,\"caption\":\"Codemotion\"},\"image\":{\"@id\":\"https:\/\/www.codemotion.com\/magazine\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/Codemotion.Italy\/\",\"https:\/\/x.com\/CodemotionIT\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.codemotion.com\/magazine\/#\/schema\/person\/8b9f025e7d76754fb3d4ffd428b0813b\",\"name\":\"Toby Moncaster\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.codemotion.com\/magazine\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/126cc1a8360e8cfbfa77aefe9160c4cd916e20f2c3a849d91e1df00c48423ccc?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/126cc1a8360e8cfbfa77aefe9160c4cd916e20f2c3a849d91e1df00c48423ccc?s=96&d=mm&r=g\",\"caption\":\"Toby Moncaster\"},\"description\":\"I am an experienced freelance writer. I specialise in making complex topics accessible to wider audiences. My interests include TCP\/IP, data protection and AI. I currently work with B2B startups across the world. I hold 5 patents, edited 3 RFCs and received a PhD in computer science from the University of Cambridge.\",\"sameAs\":[\"https:\/\/www.linkedin.com\/in\/tobymoncaster\/\",\"https:\/\/x.com\/tobym76\"],\"url\":\"https:\/\/www.codemotion.com\/magazine\/author\/toby-moncaster\/\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"The what, why and how of Javascript functional programming - Codemotion Magazine","description":"Codemotion and Facebook organized the Tech Leadership Training boot camp, heres a personal reportage from one of our attendees.","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:\/\/www.codemotion.com\/magazine\/frontend\/web-developer\/the-what-why-and-how-of-javascript-functional-programming\/","og_locale":"en_US","og_type":"article","og_title":"The what, why and how of Javascript functional programming","og_description":"Codemotion and Facebook organized the Tech Leadership Training boot camp, heres a personal reportage from one of our attendees.","og_url":"https:\/\/www.codemotion.com\/magazine\/frontend\/web-developer\/the-what-why-and-how-of-javascript-functional-programming\/","og_site_name":"Codemotion Magazine","article_publisher":"https:\/\/www.facebook.com\/Codemotion.Italy\/","article_published_time":"2019-04-16T14:49:17+00:00","article_modified_time":"2021-04-07T10:30:24+00:00","og_image":[{"width":492,"height":277,"url":"https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2019\/04\/1548b67007c16455b92f9b0e515fb6d0e50fb694.jpg","type":"image\/jpeg"}],"author":"Toby Moncaster","twitter_card":"summary_large_image","twitter_title":"The what, why and how of Javascript functional programming","twitter_creator":"@tobym76","twitter_site":"@CodemotionIT","twitter_misc":{"Written by":"Toby Moncaster","Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.codemotion.com\/magazine\/frontend\/web-developer\/the-what-why-and-how-of-javascript-functional-programming\/#article","isPartOf":{"@id":"https:\/\/www.codemotion.com\/magazine\/frontend\/web-developer\/the-what-why-and-how-of-javascript-functional-programming\/"},"author":{"name":"Toby Moncaster","@id":"https:\/\/www.codemotion.com\/magazine\/#\/schema\/person\/8b9f025e7d76754fb3d4ffd428b0813b"},"headline":"The what, why and how of Javascript functional programming","datePublished":"2019-04-16T14:49:17+00:00","dateModified":"2021-04-07T10:30:24+00:00","mainEntityOfPage":{"@id":"https:\/\/www.codemotion.com\/magazine\/frontend\/web-developer\/the-what-why-and-how-of-javascript-functional-programming\/"},"wordCount":479,"publisher":{"@id":"https:\/\/www.codemotion.com\/magazine\/#organization"},"image":{"@id":"https:\/\/www.codemotion.com\/magazine\/frontend\/web-developer\/the-what-why-and-how-of-javascript-functional-programming\/#primaryimage"},"thumbnailUrl":"https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2019\/04\/1548b67007c16455b92f9b0e515fb6d0e50fb694.jpg","keywords":["Codemotion Berlin"],"articleSection":["Web Developer"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/www.codemotion.com\/magazine\/frontend\/web-developer\/the-what-why-and-how-of-javascript-functional-programming\/","url":"https:\/\/www.codemotion.com\/magazine\/frontend\/web-developer\/the-what-why-and-how-of-javascript-functional-programming\/","name":"The what, why and how of Javascript functional programming - Codemotion Magazine","isPartOf":{"@id":"https:\/\/www.codemotion.com\/magazine\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.codemotion.com\/magazine\/frontend\/web-developer\/the-what-why-and-how-of-javascript-functional-programming\/#primaryimage"},"image":{"@id":"https:\/\/www.codemotion.com\/magazine\/frontend\/web-developer\/the-what-why-and-how-of-javascript-functional-programming\/#primaryimage"},"thumbnailUrl":"https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2019\/04\/1548b67007c16455b92f9b0e515fb6d0e50fb694.jpg","datePublished":"2019-04-16T14:49:17+00:00","dateModified":"2021-04-07T10:30:24+00:00","description":"Codemotion and Facebook organized the Tech Leadership Training boot camp, heres a personal reportage from one of our attendees.","breadcrumb":{"@id":"https:\/\/www.codemotion.com\/magazine\/frontend\/web-developer\/the-what-why-and-how-of-javascript-functional-programming\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.codemotion.com\/magazine\/frontend\/web-developer\/the-what-why-and-how-of-javascript-functional-programming\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.codemotion.com\/magazine\/frontend\/web-developer\/the-what-why-and-how-of-javascript-functional-programming\/#primaryimage","url":"https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2019\/04\/1548b67007c16455b92f9b0e515fb6d0e50fb694.jpg","contentUrl":"https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2019\/04\/1548b67007c16455b92f9b0e515fb6d0e50fb694.jpg","width":492,"height":277},{"@type":"BreadcrumbList","@id":"https:\/\/www.codemotion.com\/magazine\/frontend\/web-developer\/the-what-why-and-how-of-javascript-functional-programming\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.codemotion.com\/magazine\/"},{"@type":"ListItem","position":2,"name":"Frontend","item":"https:\/\/www.codemotion.com\/magazine\/frontend\/"},{"@type":"ListItem","position":3,"name":"Web Developer","item":"https:\/\/www.codemotion.com\/magazine\/frontend\/web-developer\/"},{"@type":"ListItem","position":4,"name":"The what, why and how of Javascript functional programming"}]},{"@type":"WebSite","@id":"https:\/\/www.codemotion.com\/magazine\/#website","url":"https:\/\/www.codemotion.com\/magazine\/","name":"Codemotion Magazine","description":"We code the future. Together","publisher":{"@id":"https:\/\/www.codemotion.com\/magazine\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.codemotion.com\/magazine\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.codemotion.com\/magazine\/#organization","name":"Codemotion","url":"https:\/\/www.codemotion.com\/magazine\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.codemotion.com\/magazine\/#\/schema\/logo\/image\/","url":"https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2019\/11\/codemotionlogo.png","contentUrl":"https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2019\/11\/codemotionlogo.png","width":225,"height":225,"caption":"Codemotion"},"image":{"@id":"https:\/\/www.codemotion.com\/magazine\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/Codemotion.Italy\/","https:\/\/x.com\/CodemotionIT"]},{"@type":"Person","@id":"https:\/\/www.codemotion.com\/magazine\/#\/schema\/person\/8b9f025e7d76754fb3d4ffd428b0813b","name":"Toby Moncaster","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.codemotion.com\/magazine\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/126cc1a8360e8cfbfa77aefe9160c4cd916e20f2c3a849d91e1df00c48423ccc?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/126cc1a8360e8cfbfa77aefe9160c4cd916e20f2c3a849d91e1df00c48423ccc?s=96&d=mm&r=g","caption":"Toby Moncaster"},"description":"I am an experienced freelance writer. I specialise in making complex topics accessible to wider audiences. My interests include TCP\/IP, data protection and AI. I currently work with B2B startups across the world. I hold 5 patents, edited 3 RFCs and received a PhD in computer science from the University of Cambridge.","sameAs":["https:\/\/www.linkedin.com\/in\/tobymoncaster\/","https:\/\/x.com\/tobym76"],"url":"https:\/\/www.codemotion.com\/magazine\/author\/toby-moncaster\/"}]}},"featured_image_src":"https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2019\/04\/1548b67007c16455b92f9b0e515fb6d0e50fb694.jpg","featured_image_src_square":"https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2019\/04\/1548b67007c16455b92f9b0e515fb6d0e50fb694.jpg","author_info":{"display_name":"Toby Moncaster","author_link":"https:\/\/www.codemotion.com\/magazine\/author\/toby-moncaster\/"},"uagb_featured_image_src":{"full":["https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2019\/04\/1548b67007c16455b92f9b0e515fb6d0e50fb694.jpg",492,277,false],"thumbnail":["https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2019\/04\/1548b67007c16455b92f9b0e515fb6d0e50fb694-150x150.jpg",150,150,true],"medium":["https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2019\/04\/1548b67007c16455b92f9b0e515fb6d0e50fb694-300x169.jpg",300,169,true],"medium_large":["https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2019\/04\/1548b67007c16455b92f9b0e515fb6d0e50fb694.jpg",492,277,false],"large":["https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2019\/04\/1548b67007c16455b92f9b0e515fb6d0e50fb694.jpg",492,277,false],"1536x1536":["https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2019\/04\/1548b67007c16455b92f9b0e515fb6d0e50fb694.jpg",492,277,false],"2048x2048":["https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2019\/04\/1548b67007c16455b92f9b0e515fb6d0e50fb694.jpg",492,277,false],"small-home-featured":["https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2019\/04\/1548b67007c16455b92f9b0e515fb6d0e50fb694.jpg",100,56,false],"sidebar-featured":["https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2019\/04\/1548b67007c16455b92f9b0e515fb6d0e50fb694-180x128.jpg",180,128,true],"genesis-singular-images":["https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2019\/04\/1548b67007c16455b92f9b0e515fb6d0e50fb694.jpg",492,277,false],"archive-featured":["https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2019\/04\/1548b67007c16455b92f9b0e515fb6d0e50fb694-400x225.jpg",400,225,true],"gb-block-post-grid-landscape":["https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2019\/04\/1548b67007c16455b92f9b0e515fb6d0e50fb694.jpg",492,277,false],"gb-block-post-grid-square":["https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2019\/04\/1548b67007c16455b92f9b0e515fb6d0e50fb694.jpg",492,277,false]},"uagb_author_info":{"display_name":"Toby Moncaster","author_link":"https:\/\/www.codemotion.com\/magazine\/author\/toby-moncaster\/"},"uagb_comment_info":0,"uagb_excerpt":"As programming geeks know, \u201cclassical\u201d programming languages, like C\/C++ and Java, are Imperative. This means you tell the computer how to do something and it does it. By contrast, functional languages are Declarative \u2013 you tell the computer the outcome you want. In his talk \u201cJavaScript functional programming: our misunderstood friend\u201d at Codemotion Berlin 2018,&#8230;&hellip;","lang":"en","_links":{"self":[{"href":"https:\/\/www.codemotion.com\/magazine\/wp-json\/wp\/v2\/posts\/154","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.codemotion.com\/magazine\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.codemotion.com\/magazine\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.codemotion.com\/magazine\/wp-json\/wp\/v2\/users\/7"}],"replies":[{"embeddable":true,"href":"https:\/\/www.codemotion.com\/magazine\/wp-json\/wp\/v2\/comments?post=154"}],"version-history":[{"count":5,"href":"https:\/\/www.codemotion.com\/magazine\/wp-json\/wp\/v2\/posts\/154\/revisions"}],"predecessor-version":[{"id":14196,"href":"https:\/\/www.codemotion.com\/magazine\/wp-json\/wp\/v2\/posts\/154\/revisions\/14196"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.codemotion.com\/magazine\/wp-json\/wp\/v2\/media\/155"}],"wp:attachment":[{"href":"https:\/\/www.codemotion.com\/magazine\/wp-json\/wp\/v2\/media?parent=154"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.codemotion.com\/magazine\/wp-json\/wp\/v2\/categories?post=154"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.codemotion.com\/magazine\/wp-json\/wp\/v2\/tags?post=154"},{"taxonomy":"collections","embeddable":true,"href":"https:\/\/www.codemotion.com\/magazine\/wp-json\/wp\/v2\/collections?post=154"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}