{"id":6797,"date":"2020-04-07T23:04:30","date_gmt":"2020-04-07T17:34:30","guid":{"rendered":"https:\/\/code4developers.com\/?p=6797"},"modified":"2020-05-10T19:27:33","modified_gmt":"2020-05-10T13:57:33","slug":"functional-programming-currying","status":"publish","type":"post","link":"https:\/\/code4developers.com\/functional-programming-currying\/","title":{"rendered":"Functional Programming in Javascript &#8211; Currying"},"content":{"rendered":"<header class=\"main__header\">\n<div class=\"main__header-inner\">\n<h1 id=\"currying-is-an-advanced-technique-of-working-with-functions-its-used-not-only-in-javascript-but-in-other-languages-as-well\" class=\"main__header-title\"><a style=\"font-size: 15px; font-weight: 400;\" href=\"https:\/\/en.wikipedia.org\/wiki\/Currying\" target=\"_blank\" rel=\"noopener\">Currying<\/a><span style=\"font-size: 15px; font-weight: 400;\"> is an advanced technique of working with functions. It\u2019s used not only in JavaScript, but in other languages as well.<\/span><\/h1>\n<\/div>\n<\/header>\n<div class=\"content\">\n<article class=\"formatted\">Currying is a transformation of functions that translates a function from callable as\u00a0<strong>f(a, b, c)<\/strong> \u00a0into callable as\u00a0<strong>f(a)(b)(c)<\/strong>.<br \/>\n<!--more--><br \/>\nCurrying doesn\u2019t call a function. It just transforms it.Let\u2019s see an example first, to better understand what we\u2019re talking about, and then practical applications.We\u2019ll create a helper function\u00a0<strong>curry(f)<\/strong>\u00a0that performs currying for a two-argument\u00a0<strong>f<\/strong>. In other words,\u00a0<strong>curry(f)<\/strong>\u00a0for two-argument\u00a0<strong>f(a, b)<\/strong>\u00a0translates it into a function that runs as\u00a0<strong>f(a)(b)<\/strong>:<\/p>\n<div class=\"code-example\" data-trusted=\"1\" data-highlight=\"[{&quot;start&quot;:0,&quot;end&quot;:6}]\" data-prism-highlighted=\"1\">\n<div class=\"codebox code-example__codebox\">\n<div class=\"codebox__code\" data-code=\"1\">\n<pre class=\"theme:github lang:default decode:true\">function curry(f) { \/\/ curry(f) does the currying transform\r\n  return function(a) {\r\n    return function(b) {\r\n      return f(a, b);\r\n    };\r\n  };\r\n}\r\n\r\n\/\/ usage\r\nfunction sum(a, b) {\r\n  return a + b;\r\n}\r\n\r\nlet curriedSum = curry(sum);\r\n\r\nalert( curriedSum(1)(2) ); \/\/ 3<\/pre>\n<\/div>\n<\/div>\n<\/div>\n<p>As you can see, the implementation is straightforward: it\u2019s just two wrappers.<\/p>\n<ul>\n<li>The result of\u00a0<strong>curry(func)<\/strong>\u00a0is a wrapper\u00a0<strong>function(a)<\/strong>.<\/li>\n<li>When it is called like\u00a0<strong>curriedSum(1)<\/strong>, the argument is saved in the Lexical Environment, and a new wrapper is returned\u00a0<strong>function(b)<\/strong>.<\/li>\n<li>Then this wrapper is called with\u00a0<strong>2<\/strong>\u00a0as an argument, and it passes the call to the original\u00a0<strong>sum<\/strong>.<\/li>\n<\/ul>\n<p>More advanced implementations of currying, such as\u00a0<a href=\"https:\/\/lodash.com\/docs#curry\" target=\"_blank\" rel=\"noopener\">_.curry<\/a> from lodash library, return a wrapper that allows a function to be called both normally and partially:<\/p>\n<div class=\"code-example\" data-trusted=\"1\" data-prism-highlighted=\"1\">\n<div class=\"codebox code-example__codebox\">\n<div class=\"codebox__code\" data-code=\"1\">\n<pre class=\"lang:default decode:true\">function sum(a, b) {\r\n  return a + b;\r\n}\r\n\r\nlet curriedSum = _.curry(sum); \/\/ using _.curry from lodash library\r\n\r\nalert( curriedSum(1, 2) ); \/\/ 3, still callable normally\r\nalert( curriedSum(1)(2) ); \/\/ 3, called partially<\/pre>\n<\/div>\n<\/div>\n<\/div>\n<h2 id=\"currying-what-for\"><a class=\"main__anchor\" href=\"https:\/\/javascript.info\/currying-partials#currying-what-for\" name=\"currying-what-for\" target=\"_blank\" rel=\"noopener\">Currying? What for?<\/a><\/h2>\n<p>To understand the benefits we need a worthy real-life example.<\/p>\n<p>For instance, we have the logging function\u00a0<strong>log(date, importance, message)<\/strong>\u00a0that formats and outputs the information. In real projects such functions have many useful features like sending logs over the network, here we\u2019ll just use\u00a0<strong>alert<\/strong>:<\/p>\n<div class=\"code-example\" data-trusted=\"1\" data-prism-highlighted=\"1\">\n<div class=\"codebox code-example__codebox\">\n<div class=\"codebox__code\" data-code=\"1\">\n<pre class=\"theme:github lang:default decode:true\">function log(date, importance, message) {\r\n  alert(`[${date.getHours()}:${date.getMinutes()}] [${importance}] ${message}`);\r\n}<\/pre>\n<\/div>\n<\/div>\n<\/div>\n<p>Let\u2019s curry it!<\/p>\n<div class=\"code-example\" data-trusted=\"1\" data-prism-highlighted=\"1\">\n<div class=\"codebox code-example__codebox\">\n<div class=\"codebox__code\" data-code=\"1\">\n<pre class=\"theme:github lang:default decode:true\">log = _.curry(log);<\/pre>\n<\/div>\n<\/div>\n<\/div>\n<p>After that\u00a0<strong>log<\/strong>\u00a0works normally:<\/p>\n<div class=\"code-example\" data-trusted=\"1\" data-prism-highlighted=\"1\">\n<div class=\"codebox code-example__codebox\">\n<div class=\"codebox__code\" data-code=\"1\">\n<pre class=\"theme:github lang:default decode:true\">log(new Date(), \"DEBUG\", \"some debug\"); \/\/ log(a, b, c)<\/pre>\n<\/div>\n<\/div>\n<\/div>\n<p>\u2026But also works in the curried form:<\/p>\n<div class=\"code-example\" data-trusted=\"1\" data-prism-highlighted=\"1\">\n<div class=\"codebox code-example__codebox\">\n<div class=\"codebox__code\" data-code=\"1\">\n<pre class=\"theme:github lang:default decode:true\">log(new Date())(\"DEBUG\")(\"some debug\"); \/\/ log(a)(b)(c)<\/pre>\n<\/div>\n<\/div>\n<\/div>\n<p>Now we can easily make a convenience function for current logs:<\/p>\n<div class=\"code-example\" data-trusted=\"1\" data-prism-highlighted=\"1\">\n<div class=\"codebox code-example__codebox\">\n<div class=\"codebox__code\" data-code=\"1\">\n<pre class=\"theme:github lang:default decode:true\">\/\/ logNow will be the partial of log with fixed first argument\r\nlet logNow = log(new Date());\r\n\r\n\/\/ use it\r\nlogNow(\"INFO\", \"message\"); \/\/ [HH:mm] INFO message<\/pre>\n<\/div>\n<\/div>\n<\/div>\n<p>Now\u00a0<strong>logNow<\/strong>\u00a0is\u00a0<strong>log<\/strong>\u00a0with fixed first argument, in other words \u201cpartially applied function\u201d or \u201cpartial\u201d for short.<\/p>\n<p>We can go further and make a convenience function for current debug logs:<\/p>\n<div class=\"code-example\" data-trusted=\"1\" data-prism-highlighted=\"1\">\n<div class=\"codebox code-example__codebox\">\n<div class=\"codebox__code\" data-code=\"1\">\n<pre class=\"lang:default decode:true\">let debugNow = logNow(\"DEBUG\");\r\n\r\ndebugNow(\"message\"); \/\/ [HH:mm] DEBUG message<\/pre>\n<p>So:<\/p>\n<\/div>\n<\/div>\n<\/div>\n<ol>\n<li style=\"list-style-type: none;\">\n<ol>\n<li style=\"list-style-type: none;\">\n<ol>\n<li>We didn\u2019t lose anything after currying:\u00a0<strong>log<\/strong>\u00a0is still callable normally.<\/li>\n<li>We can easily generate partial functions such as for today\u2019s logs.<\/li>\n<\/ol>\n<\/li>\n<\/ol>\n<\/li>\n<\/ol>\n<h2 id=\"advanced-curry-implementation\"><a class=\"main__anchor\" href=\"https:\/\/javascript.info\/currying-partials#advanced-curry-implementation\" name=\"advanced-curry-implementation\" target=\"_blank\" rel=\"noopener\">Advanced curry implementation<\/a><\/h2>\n<p>In case you\u2019d like to get in to the details, here\u2019s the \u201cadvanced\u201d curry implementation for multi-argument functions that we could use above.<\/p>\n<p>It\u2019s pretty short:<\/p>\n<div class=\"code-example\" data-trusted=\"1\" data-prism-highlighted=\"1\">\n<div class=\"codebox code-example__codebox\">\n<div class=\"codebox__code\" data-code=\"1\">\n<pre class=\"theme:github lang:default decode:true\">function curry(func) {\r\n\r\n  return function curried(...args) {\r\n    if (args.length &gt;= func.length) {\r\n      return func.apply(this, args);\r\n    } else {\r\n      return function(...args2) {\r\n        return curried.apply(this, args.concat(args2));\r\n      }\r\n    }\r\n  };\r\n\r\n}<\/pre>\n<\/div>\n<\/div>\n<\/div>\n<p>Usage examples:<\/p>\n<div class=\"code-example\" data-trusted=\"1\" data-prism-highlighted=\"1\">\n<div class=\"codebox code-example__codebox\">\n<div class=\"codebox__code\" data-code=\"1\">\n<pre class=\"theme:github lang:default decode:true\">function sum(a, b, c) {\r\n  return a + b + c;\r\n}\r\nlet curriedSum = curry(sum);\r\nalert( curriedSum(1, 2, 3) ); \/\/ 6, still callable normally\r\nalert( curriedSum(1)(2,3) ); \/\/ 6, currying of 1st arg\r\nalert( curriedSum(1)(2)(3) ); \/\/ 6, full currying<\/pre>\n<\/div>\n<\/div>\n<\/div>\n<p>The new\u00a0<strong>curry<\/strong>\u00a0may look complicated, but it\u2019s actually easy to understand.<\/p>\n<p>The result of\u00a0<strong>curry(func)<\/strong>\u00a0call is the wrapper\u00a0<strong>curried<\/strong>\u00a0that looks like this:<\/p>\n<div class=\"code-example\" data-trusted=\"1\" data-prism-highlighted=\"1\">\n<div class=\"codebox code-example__codebox\">\n<div class=\"codebox__code\" data-code=\"1\">\n<pre class=\"theme:github lang:default decode:true\">\/\/ func is the function to transform\r\nfunction curried(...args){\r\n       if (args.length &gt;= func.length)\r\n           { \/\/ (1)\r\n               return func.apply(this, args);\r\n           } else {\r\n               return function pass(...args2) { \/\/ (2)\r\n                   return curried.apply(this, args.concat(args2));\r\n                }\r\n           }\r\n   };<\/pre>\n<\/div>\n<\/div>\n<\/div>\n<p>When we run it, there are two\u00a0<strong>if<\/strong>\u00a0execution branches:<\/p>\n<ol>\n<li>Call now: if passed\u00a0<strong>args<\/strong>\u00a0count is the same as the original function has in its definition (<strong>func.length<\/strong>) or longer, then just pass the call to it.<\/li>\n<li>Get a partial: otherwise,\u00a0<strong>func<\/strong>\u00a0is not called yet. Instead, another wrapper\u00a0<strong>pass<\/strong>\u00a0is returned, that will re-apply\u00a0<strong>curried<\/strong>\u00a0providing previous arguments together with the new ones. Then on a new call, again, we\u2019ll get either a new partial (if not enough arguments) or, finally, the result.<\/li>\n<\/ol>\n<p>For instance, let\u2019s see what happens in the case of\u00a0<strong>sum(a, b, c)<\/strong>. Three arguments, so\u00a0<strong>sum.length = 3<\/strong>.<\/p>\n<p>For the call\u00a0<strong>curried(1)(2)(3)<\/strong>:<\/p>\n<ol>\n<li>The first call\u00a0<strong>curried(1)<\/strong>\u00a0remembers\u00a0<strong>1<\/strong>\u00a0in its Lexical Environment, and returns a wrapper\u00a0<strong>pass<\/strong>.<\/li>\n<li>The wrapper\u00a0<strong>pass<\/strong>\u00a0is called with\u00a0<strong>(2)<\/strong>: it takes previous args (<strong>1<\/strong>), concatenates them with what it got\u00a0<strong>(2)<\/strong>\u00a0and calls\u00a0<strong>curried(1, 2)<\/strong>\u00a0with them together. As the argument count is still less than 3,\u00a0<strong>curry<\/strong>\u00a0returns\u00a0<strong>pass<\/strong>.<\/li>\n<li>The wrapper\u00a0<strong>pass<\/strong>\u00a0is called again with\u00a0<strong>(3)<\/strong>, for the next call\u00a0<strong>pass(3)<\/strong>\u00a0takes previous args <strong>(1,\u00a02)<\/strong> and adds\u00a0<strong>3<\/strong>\u00a0to them, making the call\u00a0<strong>curried(1, 2, 3)<\/strong>\u00a0\u2013 there are\u00a0<strong>3<\/strong>\u00a0arguments at last, they are given to the original function.<\/li>\n<\/ol>\n<p>If that\u2019s still not obvious, just trace the calls sequence in your mind or on paper.<\/p>\n<div class=\"important important_smart\">\n<div class=\"important__header\"><span class=\"important__type\">Fixed-length functions only<\/span><\/div>\n<div class=\"important__content\">\n<p>The currying requires the function to have a fixed number of arguments.<\/p>\n<p>A function that uses rest parameters, such as\u00a0<strong>f(&#8230;args)<\/strong>, can\u2019t be curried this way.<\/p>\n<\/div>\n<\/div>\n<div class=\"important important_smart\">\n<div class=\"important__header\"><span class=\"important__type\">A little more than currying<\/span><\/div>\n<div class=\"important__content\">\n<p>By definition, currying should convert\u00a0<strong>sum(a, b, c)<\/strong>\u00a0into\u00a0<strong>sum(a)(b)(c)<\/strong>.<\/p>\n<p>But most implementations of currying in JavaScript are advanced, as described: they also keep the function callable in the multi-argument variant.<\/p>\n<\/div>\n<\/div>\n<h2 id=\"summary\">Summary<\/h2>\n<p>Currying\u00a0is a transform that makes\u00a0<strong>f(a,b,c)<\/strong>\u00a0callable as\u00a0<strong>f(a)(b)(c)<\/strong>. JavaScript implementations usually both keep the function callable normally and return the partial if the arguments count is not enough.<\/p>\n<p>Currying allows us to easily get partials. As we\u2019ve seen in the logging example, after currying the three argument universal function\u00a0<strong>log(date, importance, message)<\/strong>\u00a0gives us partials when called with one argument (like\u00a0<strong>log(date)<\/strong>) or two arguments (like\u00a0<strong>log(date, importance)<\/strong>).<\/p>\n<p>&nbsp;<\/p>\n<\/article>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>Currying is an advanced technique of working with functions. It\u2019s used not only in JavaScript, but in other languages as well. Currying is a transformation of functions that translates a&hellip;<\/p>\n","protected":false},"author":7,"featured_media":6799,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[2],"tags":[311,314,313,22,312],"powerkit_post_featured":[],"class_list":{"0":"post-6797","1":"post","2":"type-post","3":"status-publish","4":"format-standard","5":"has-post-thumbnail","7":"category-javascript","8":"tag-currying","9":"tag-functional-programming","10":"tag-functional-programming-in-javascript-currying","11":"tag-javascript","12":"tag-javascript-functions"},"jetpack_featured_media_url":"https:\/\/i0.wp.com\/code4developers.com\/wp-content\/uploads\/2020\/04\/avatar-js.png?fit=512%2C512&ssl=1","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p8NAi4-1LD","jetpack-related-posts":[{"id":7069,"url":"https:\/\/code4developers.com\/ways-to-use-generator-functions-in-javascript\/","url_meta":{"origin":6797,"position":0},"title":"Ways to use Generator Functions in JavaScript","author":"Arif Khoja","date":"May 15, 2020","format":false,"excerpt":"In this Article we will see below points Generator Functions Recap: Functions How does it work? 4 ways to use Generator Functions with Examples Advantages of using Generator function What are Generator Functions? Ever imagined what would happen if a function had an infinite input or output to deal with?\u2026","rel":"","context":"In &quot;JavaScript&quot;","block_context":{"text":"JavaScript","link":"https:\/\/code4developers.com\/category\/javascript\/"},"img":{"alt_text":"Functional-programming-js","src":"https:\/\/i0.wp.com\/code4developers.com\/wp-content\/uploads\/2020\/04\/avatar-js.png?fit=512%2C512&ssl=1&resize=350%2C200","width":350,"height":200},"classes":[]},{"id":2674,"url":"https:\/\/code4developers.com\/pick-your-programming-language\/","url_meta":{"origin":6797,"position":1},"title":"Pick Your Programming Language","author":"Pawan Ingale","date":"June 27, 2017","format":false,"excerpt":"In the IT industry, new technologies are emerging fast. Staying ahead of everyone in the tech market it is very important for every programmer, with changing necessities and new in-demand programming languages for the next years. So here is the list of some technologies which a programmer can choose to\u2026","rel":"","context":"In &quot;Programming&quot;","block_context":{"text":"Programming","link":"https:\/\/code4developers.com\/category\/programming\/"},"img":{"alt_text":"Programming Languages","src":"https:\/\/i0.wp.com\/code4developers.com\/wp-content\/uploads\/2017\/06\/1-3.png?resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/code4developers.com\/wp-content\/uploads\/2017\/06\/1-3.png?resize=350%2C200 1x, https:\/\/i0.wp.com\/code4developers.com\/wp-content\/uploads\/2017\/06\/1-3.png?resize=525%2C300 1.5x"},"classes":[]},{"id":3311,"url":"https:\/\/code4developers.com\/default-parameter-in-a-javascript-function\/","url_meta":{"origin":6797,"position":2},"title":"Default Parameter in JavaScript function","author":"Yatendrasinh Joddha","date":"March 17, 2018","format":false,"excerpt":"In any programming language we often require having default parameter or default value for the parameter in a function. JavaScript allow us to initialize parameter a default value. If you are not passing any value to the parameter, then the default value of the parameter will be undefined. Let's consider\u2026","rel":"","context":"In &quot;JavaScript&quot;","block_context":{"text":"JavaScript","link":"https:\/\/code4developers.com\/category\/javascript\/"},"img":{"alt_text":"javascript","src":"https:\/\/i0.wp.com\/code4developers.com\/wp-content\/uploads\/2017\/10\/javascript.jpg?fit=750%2C422&ssl=1&resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/code4developers.com\/wp-content\/uploads\/2017\/10\/javascript.jpg?fit=750%2C422&ssl=1&resize=350%2C200 1x, https:\/\/i0.wp.com\/code4developers.com\/wp-content\/uploads\/2017\/10\/javascript.jpg?fit=750%2C422&ssl=1&resize=525%2C300 1.5x, https:\/\/i0.wp.com\/code4developers.com\/wp-content\/uploads\/2017\/10\/javascript.jpg?fit=750%2C422&ssl=1&resize=700%2C400 2x"},"classes":[]},{"id":3171,"url":"https:\/\/code4developers.com\/programming-asynchronously-promises\/","url_meta":{"origin":6797,"position":3},"title":"Programming asynchronously: Promises","author":"Arif Khoja","date":"December 20, 2017","format":false,"excerpt":"Promises are in many ways the logical next step from callback. A promise is just a special object that promise to either resolve, or throw an exception. Promises are easy to use, and easy to make. For example this is how you use some kind of library that uses promises:\u2026","rel":"","context":"In &quot;JavaScript&quot;","block_context":{"text":"JavaScript","link":"https:\/\/code4developers.com\/category\/javascript\/"},"img":{"alt_text":"javascript","src":"https:\/\/i0.wp.com\/code4developers.com\/wp-content\/uploads\/2017\/10\/javascript.jpg?fit=750%2C422&ssl=1&resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/code4developers.com\/wp-content\/uploads\/2017\/10\/javascript.jpg?fit=750%2C422&ssl=1&resize=350%2C200 1x, https:\/\/i0.wp.com\/code4developers.com\/wp-content\/uploads\/2017\/10\/javascript.jpg?fit=750%2C422&ssl=1&resize=525%2C300 1.5x, https:\/\/i0.wp.com\/code4developers.com\/wp-content\/uploads\/2017\/10\/javascript.jpg?fit=750%2C422&ssl=1&resize=700%2C400 2x"},"classes":[]},{"id":3318,"url":"https:\/\/code4developers.com\/arguments-object-javascript-function\/","url_meta":{"origin":6797,"position":4},"title":"arguments object in JavaScript function","author":"Yatendrasinh Joddha","date":"March 19, 2018","format":false,"excerpt":"The arguments object is an Array-like object matching to the arguments passed to a function. The arguments object is a local variable available within all (non-arrow) functions. You can refer to a function's arguments within the function by using the arguments object.Let's consider below code: function addition(num1, num2) { return\u2026","rel":"","context":"In &quot;JavaScript&quot;","block_context":{"text":"JavaScript","link":"https:\/\/code4developers.com\/category\/javascript\/"},"img":{"alt_text":"javascript","src":"https:\/\/i0.wp.com\/code4developers.com\/wp-content\/uploads\/2017\/10\/javascript.jpg?fit=750%2C422&ssl=1&resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/code4developers.com\/wp-content\/uploads\/2017\/10\/javascript.jpg?fit=750%2C422&ssl=1&resize=350%2C200 1x, https:\/\/i0.wp.com\/code4developers.com\/wp-content\/uploads\/2017\/10\/javascript.jpg?fit=750%2C422&ssl=1&resize=525%2C300 1.5x, https:\/\/i0.wp.com\/code4developers.com\/wp-content\/uploads\/2017\/10\/javascript.jpg?fit=750%2C422&ssl=1&resize=700%2C400 2x"},"classes":[]},{"id":3321,"url":"https:\/\/code4developers.com\/spread-syntax-in-javascript\/","url_meta":{"origin":6797,"position":5},"title":"Spread syntax (three dots) in JavaScript","author":"Yatendrasinh Joddha","date":"March 21, 2018","format":false,"excerpt":"Spread syntax which is used by typing three dots (...) in JavaScript. It allows an array expression or string or anything which can be iterating to be expanded in places where zero or more arguments for function calls\u00a0or elements for array are expected. It can also be used for an\u2026","rel":"","context":"In &quot;JavaScript&quot;","block_context":{"text":"JavaScript","link":"https:\/\/code4developers.com\/category\/javascript\/"},"img":{"alt_text":"javascript","src":"https:\/\/i0.wp.com\/code4developers.com\/wp-content\/uploads\/2017\/10\/javascript.jpg?fit=750%2C422&ssl=1&resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/code4developers.com\/wp-content\/uploads\/2017\/10\/javascript.jpg?fit=750%2C422&ssl=1&resize=350%2C200 1x, https:\/\/i0.wp.com\/code4developers.com\/wp-content\/uploads\/2017\/10\/javascript.jpg?fit=750%2C422&ssl=1&resize=525%2C300 1.5x, https:\/\/i0.wp.com\/code4developers.com\/wp-content\/uploads\/2017\/10\/javascript.jpg?fit=750%2C422&ssl=1&resize=700%2C400 2x"},"classes":[]}],"jetpack_likes_enabled":true,"_links":{"self":[{"href":"https:\/\/code4developers.com\/wp-json\/wp\/v2\/posts\/6797","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/code4developers.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/code4developers.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/code4developers.com\/wp-json\/wp\/v2\/users\/7"}],"replies":[{"embeddable":true,"href":"https:\/\/code4developers.com\/wp-json\/wp\/v2\/comments?post=6797"}],"version-history":[{"count":5,"href":"https:\/\/code4developers.com\/wp-json\/wp\/v2\/posts\/6797\/revisions"}],"predecessor-version":[{"id":6809,"href":"https:\/\/code4developers.com\/wp-json\/wp\/v2\/posts\/6797\/revisions\/6809"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/code4developers.com\/wp-json\/wp\/v2\/media\/6799"}],"wp:attachment":[{"href":"https:\/\/code4developers.com\/wp-json\/wp\/v2\/media?parent=6797"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/code4developers.com\/wp-json\/wp\/v2\/categories?post=6797"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/code4developers.com\/wp-json\/wp\/v2\/tags?post=6797"},{"taxonomy":"powerkit_post_featured","embeddable":true,"href":"https:\/\/code4developers.com\/wp-json\/wp\/v2\/powerkit_post_featured?post=6797"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}