{"id":3502,"date":"2022-06-21T14:00:00","date_gmt":"2022-06-21T14:00:00","guid":{"rendered":"http:\/\/the-codest.localhost\/blog\/functional-programming-in-javascript-part-3-functor-monad-maybe\/"},"modified":"2026-03-11T05:59:01","modified_gmt":"2026-03-11T05:59:01","slug":"%ce%bb%ce%b5%ce%b9%cf%84%ce%bf%cf%85%cf%81%ce%b3%ce%b9%ce%ba%cf%8c%cf%82-%cf%80%cf%81%ce%bf%ce%b3%cf%81%ce%b1%ce%bc%ce%bc%ce%b1%cf%84%ce%b9%cf%83%ce%bc%cf%8c%cf%82-%cf%83%ce%b5-javascript-%ce%bc%ce%ad","status":"publish","type":"post","link":"https:\/\/thecodest.co\/el\/blog\/functional-programming-in-javascript-part-3-functor-monad-maybe\/","title":{"rendered":"\u039b\u03b5\u03b9\u03c4\u03bf\u03c5\u03c1\u03b3\u03b9\u03ba\u03cc\u03c2 \u03c0\u03c1\u03bf\u03b3\u03c1\u03b1\u03bc\u03bc\u03b1\u03c4\u03b9\u03c3\u03bc\u03cc\u03c2 \u03c3\u03c4\u03bf JavaScript \u039c\u03ad\u03c1\u03bf\u03c2 3 - \u039b\u03b5\u03b9\u03c4\u03bf\u03c5\u03c1\u03b3\u03cc\u03c2 &amp; \u039c\u03bf\u03bd\u03ac\u03b4\u03b1 \u038a\u03c3\u03c9\u03c2"},"content":{"rendered":"<h2 class=\"wp-block-heading\">\u0395\u03b9\u03c3\u03b1\u03b3\u03c9\u03b3\u03ae<\/h2>\n\n\n\n<p>\u03a3\u03c5\u03c7\u03bd\u03ac \u03b7 \u03b4\u03b9\u03b1\u03c4\u03ae\u03c1\u03b7\u03c3\u03b7 \u03bc\u03b7 \u03c4\u03c1\u03bf\u03c0\u03bf\u03c0\u03bf\u03b9\u03ae\u03c3\u03b9\u03bc\u03c9\u03bd \u03b5\u03af\u03bd\u03b1\u03b9 \u03b4\u03cd\u03c3\u03ba\u03bf\u03bb\u03bf \u03bd\u03b1 \u03b4\u03b9\u03b1\u03c4\u03b7\u03c1\u03b7\u03b8\u03b5\u03af. \u03a4\u03bf \u03bc\u03bf\u03c4\u03af\u03b2\u03bf \u03c4\u03bf\u03c5 \u03c0\u03b5\u03c1\u03b9\u03c4\u03c5\u03bb\u03af\u03b3\u03bc\u03b1\u03c4\u03bf\u03c2 <a href=\"https:\/\/thecodest.co\/el\/blog\/app-data-collection-security-risks-value-and-types-explored\/\">\u03b4\u03b5\u03b4\u03bf\u03bc\u03ad\u03bd\u03b1<\/a> \u03c3\u03b5 \u03ad\u03bd\u03b1 \u03b5\u03bc\u03c0\u03bf\u03c1\u03b5\u03c5\u03bc\u03b1\u03c4\u03bf\u03ba\u03b9\u03b2\u03ce\u03c4\u03b9\u03bf \u03ad\u03c1\u03c7\u03b5\u03c4\u03b1\u03b9 \u03bd\u03b1 \u03c3\u03ce\u03c3\u03b5\u03b9. \u0391\u03c3\u03c6\u03b1\u03bb\u03af\u03b6\u03b5\u03b9 \u03c4\u03b9\u03c2 \u03c4\u03b9\u03bc\u03ad\u03c2, \u03ce\u03c3\u03c4\u03b5 \u03bf \u03c7\u03b5\u03b9\u03c1\u03b9\u03c3\u03bc\u03cc\u03c2 \u03c4\u03bf\u03c5\u03c2 \u03bd\u03b1 \u03b5\u03af\u03bd\u03b1\u03b9 \u03b1\u03c3\u03c6\u03b1\u03bb\u03ae\u03c2 \u03bc\u03b5 \u03b1\u03c0\u03bf\u03ba\u03bb\u03b5\u03b9\u03c3\u03bc\u03cc \u03c4\u03c9\u03bd \u03c0\u03b1\u03c1\u03b5\u03bd\u03b5\u03c1\u03b3\u03b5\u03b9\u03ce\u03bd.<\/p>\n\n\n\n<p>\u0391\u03bd \u03b5\u03af\u03c3\u03c4\u03b5 \u03bd\u03ad\u03bf\u03b9 \u03b5\u03b4\u03ce, \u03b2\u03b5\u03b2\u03b1\u03b9\u03c9\u03b8\u03b5\u03af\u03c4\u03b5 \u03cc\u03c4\u03b9 \u03ad\u03c7\u03b5\u03c4\u03b5 \u03b5\u03bb\u03ad\u03b3\u03be\u03b5\u03b9 \u03c4\u03b1 2 \u03c4\u03b5\u03bb\u03b5\u03c5\u03c4\u03b1\u03af\u03b1 \u03bc\u03ad\u03c1\u03b7 \u03bc\u03bf\u03c5 \u03c3\u03c7\u03b5\u03c4\u03b9\u03ba\u03ac \u03bc\u03b5 \u03c4\u03bf\u03bd \u03bb\u03b5\u03b9\u03c4\u03bf\u03c5\u03c1\u03b3\u03b9\u03ba\u03cc \u03c0\u03c1\u03bf\u03b3\u03c1\u03b1\u03bc\u03bc\u03b1\u03c4\u03b9\u03c3\u03bc\u03cc \u03c3\u03c4\u03bf <a href=\"https:\/\/thecodest.co\/el\/blog\/vibrant-upturn-charting-the-resolute-rise-of-swedish-firms\/\">The Codest<\/a> blog \u03b3\u03b9\u03b1:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><a href=\"https:\/\/thecodest.co\/blog\/power-of-functional-programming-in-javascript-part-1-introduction\">\u039c\u03ad\u03c1\u03bf\u03c2 1 - \u0395\u03b9\u03c3\u03b1\u03b3\u03c9\u03b3\u03ae<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/thecodest.co\/blog\/power-of-functional-programming-in-javascript-part-2-combinators\">\u039c\u03ad\u03c1\u03bf\u03c2 2 - \u03a3\u03c5\u03bd\u03b4\u03c5\u03b1\u03c3\u03c4\u03ad\u03c2<\/a><\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">\u039b\u03b5\u03b9\u03c4\u03bf\u03c5\u03c1\u03b3\u03cc\u03c2<\/h2>\n\n\n\n<p>\u0394\u03b5\u03bd \u03ad\u03c7\u03b5\u03b9 \u03c0\u03bf\u03bb\u03cd\u03c0\u03bb\u03bf\u03ba\u03b7 \u03bb\u03bf\u03b3\u03b9\u03ba\u03ae. \u03a4\u03bf \u03ba\u03cd\u03c1\u03b9\u03bf \u03ba\u03b1\u03b8\u03ae\u03ba\u03bf\u03bd \u03c4\u03bf\u03c5 \u03b5\u03af\u03bd\u03b1\u03b9 \u03bd\u03b1 \u03c4\u03c5\u03bb\u03af\u03b3\u03b5\u03b9 \u03c4\u03bf \u03c0\u03bb\u03b1\u03af\u03c3\u03b9\u03bf \u03ba\u03b1\u03b9 \u03bd\u03b1 \u03b5\u03ba\u03c4\u03b5\u03bb\u03b5\u03af \u03c4\u03b9\u03c2 \u03bb\u03b5\u03b9\u03c4\u03bf\u03c5\u03c1\u03b3\u03af\u03b5\u03c2 \u03c0\u03bf\u03c5 \u03bb\u03b1\u03bc\u03b2\u03ac\u03bd\u03b5\u03b9 \u03b1\u03c0\u03cc \u03c4\u03bf \u03b5\u03be\u03c9\u03c4\u03b5\u03c1\u03b9\u03ba\u03cc \u03c3\u03b5 \u03b1\u03c5\u03c4\u03ac. \u039a\u03ac\u03b8\u03b5 \u03c6\u03bf\u03c1\u03ac \u03c0\u03bf\u03c5 \u03b1\u03bb\u03bb\u03ac\u03b6\u03b5\u03b9 \u03b7 \u03c4\u03b9\u03bc\u03ae, \u03bc\u03b9\u03b1 \u03bd\u03ad\u03b1 \u03c0\u03b5\u03c1\u03af\u03c0\u03c4\u03c9\u03c3\u03b7 \u03c0\u03b5\u03c1\u03b9\u03ad\u03ba\u03c4\u03b7 \u03b5\u03c0\u03b1\u03bd\u03b1\u03c3\u03c5\u03c3\u03ba\u03b5\u03c5\u03ac\u03b6\u03b5\u03c4\u03b1\u03b9 \u03ba\u03b1\u03b9 \u03b5\u03c0\u03b9\u03c3\u03c4\u03c1\u03ad\u03c6\u03b5\u03c4\u03b1\u03b9. \u039a\u03b1\u03c4\u03ac \u03c4\u03b7\u03bd \u03ba\u03bb\u03ae\u03c3\u03b7 \u03c4\u03bf\u03c5 <b>\u03c7\u03ac\u03c1\u03c4\u03b7\u03c2<\/b> \u03bc\u03ad\u03b8\u03bf\u03b4\u03bf\u03c2, \u03b7 \u03bf\u03c0\u03bf\u03af\u03b1 \u03bb\u03b1\u03bc\u03b2\u03ac\u03bd\u03b5\u03b9 \u03bc\u03b9\u03b1 \u03c3\u03c5\u03b3\u03ba\u03b5\u03ba\u03c1\u03b9\u03bc\u03ad\u03bd\u03b7 \u03b5\u03bd\u03ad\u03c1\u03b3\u03b5\u03b9\u03b1, \u03b5\u03c0\u03b9\u03c3\u03c4\u03c1\u03ad\u03c6\u03b5\u03b9 \u03bc\u03b9\u03b1 \u03bd\u03ad\u03b1 \u03c0\u03b5\u03c1\u03af\u03c0\u03c4\u03c9\u03c3\u03b7 \u03b4\u03bf\u03c7\u03b5\u03af\u03bf\u03c5 \u03bc\u03b5 \u03c4\u03b7\u03bd \u03c4\u03b9\u03bc\u03ae \u03c0\u03bf\u03c5 \u03b5\u03c0\u03b9\u03c3\u03c4\u03c1\u03ad\u03c6\u03b5\u03b9 \u03b7 \u03c0\u03b5\u03c1\u03b1\u03c3\u03bc\u03ad\u03bd\u03b7 \u03c3\u03c5\u03bd\u03ac\u03c1\u03c4\u03b7\u03c3\u03b7, \u03b4\u03b9\u03b1\u03c4\u03b7\u03c1\u03ce\u03bd\u03c4\u03b1\u03c2 \u03c4\u03b7\u03bd \u03b1\u03c1\u03c7\u03ae \u03c4\u03b7\u03c2 \u03bc\u03b7 \u03c4\u03c1\u03bf\u03c0\u03bf\u03c0\u03bf\u03af\u03b7\u03c3\u03b7\u03c2.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">\u0394\u03ae\u03bb\u03c9\u03c3\u03b7<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"javascript\" class=\"language-javascript\"><code> const Functor = value =&gt; ({\n     map: fn =&gt; Functor(fn(value)),\n     chain: fn =&gt; fn(value),\n     of: () =&gt; value\n });<\/code><\/code><\/pre>\n\n\n\n<p><b>\u03c7\u03ac\u03c1\u03c4\u03b7\u03c2<\/b> - \u03c7\u03c1\u03ae\u03c3\u03b9\u03bc\u03bf \u03cc\u03c4\u03b1\u03bd \u03b8\u03ad\u03bb\u03b5\u03c4\u03b5 \u03bd\u03b1 \u03b1\u03bb\u03bb\u03ac\u03be\u03b5\u03c4\u03b5 \u03c4\u03b7\u03bd \u03ba\u03b1\u03c4\u03ac\u03c3\u03c4\u03b1\u03c3\u03b7 \u03bc\u03b9\u03b1\u03c2 \u03c4\u03b9\u03bc\u03ae\u03c2 \u03c3\u03b5 \u03ad\u03bd\u03b1 \u03b4\u03bf\u03c7\u03b5\u03af\u03bf \u03b1\u03bb\u03bb\u03ac \u03b4\u03b5\u03bd \u03b8\u03ad\u03bb\u03b5\u03c4\u03b5 \u03bd\u03b1 \u03c4\u03b7\u03bd \u03b5\u03c0\u03b9\u03c3\u03c4\u03c1\u03ad\u03c8\u03b5\u03c4\u03b5 \u03b1\u03ba\u03cc\u03bc\u03b1.<\/p>\n\n\n\n<p><b>\u03b1\u03bb\u03c5\u03c3\u03af\u03b4\u03b1<\/b> - \u03c7\u03c1\u03b7\u03c3\u03b9\u03bc\u03bf\u03c0\u03bf\u03b9\u03b5\u03af\u03c4\u03b1\u03b9 \u03b1\u03bd \u03b8\u03ad\u03bb\u03b5\u03c4\u03b5 \u03bd\u03b1 \u03c0\u03b5\u03c1\u03ac\u03c3\u03b5\u03c4\u03b5 \u03bc\u03b9\u03b1 \u03c4\u03b9\u03bc\u03ae \u03c3\u03b5 \u03bc\u03b9\u03b1 \u03c3\u03c5\u03bd\u03ac\u03c1\u03c4\u03b7\u03c3\u03b7 \u03c7\u03c9\u03c1\u03af\u03c2 \u03bd\u03b1 \u03c4\u03c1\u03bf\u03c0\u03bf\u03c0\u03bf\u03b9\u03ae\u03c3\u03b5\u03c4\u03b5 \u03c4\u03b7\u03bd \u03ba\u03b1\u03c4\u03ac\u03c3\u03c4\u03b1\u03c3\u03b7 \u03c4\u03bf\u03c5 \u03b4\u03bf\u03c7\u03b5\u03af\u03bf\u03c5. \u03a3\u03c5\u03bd\u03ae\u03b8\u03c9\u03c2 \u03c3\u03c4\u03bf \u03c4\u03ad\u03bb\u03bf\u03c2 \u03c4\u03b7\u03c2 <b>\u03c7\u03ac\u03c1\u03c4\u03b7\u03c2<\/b> \u03ba\u03bb\u03ae\u03c3\u03b5\u03b9\u03c2.<\/p>\n\n\n\n<p><b>\u03c4\u03bf\u03c5<\/b> - \u03b5\u03c0\u03b9\u03c3\u03c4\u03c1\u03bf\u03c6\u03ae \u03c4\u03c1\u03ad\u03c7\u03bf\u03c5\u03c3\u03b1\u03c2 \u03c4\u03b9\u03bc\u03ae\u03c2<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">\u0395\u03c0\u03b9\u03c4\u03b1\u03ba\u03c4\u03b9\u03ba\u03cc \u03c0\u03b1\u03c1\u03ac\u03b4\u03b5\u03b9\u03b3\u03bc\u03b1<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"javascript\" class=\"language-javascript\">const randomInt = (max) =&gt; Math.floor(Math.random() * (max + 1))\n\nconst randomNumber = randomInt(200) \/\/ \u03b5\u03c0\u03b9\u03c3\u03c4\u03c1\u03ad\u03c6\u03b5\u03b9 \u03b1\u03c1\u03b9\u03b8\u03bc\u03cc \u03bc\u03b5\u03c4\u03b1\u03be\u03cd 0 \u03ba\u03b1\u03b9 200\n\ndecrease(randomNumber) \/\/ \u03b5\u03c0\u03b9\u03c3\u03c4\u03c1\u03ad\u03c6\u03b5\u03b9 (\u03b1\u03c1\u03b9\u03b8\u03bc\u03cc \u03bc\u03b5\u03c4\u03b1\u03be\u03cd 0 \u03ba\u03b1\u03b9 200) - 1<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">\u0394\u03b7\u03bb\u03c9\u03c4\u03b9\u03ba\u03cc \u03c0\u03b1\u03c1\u03ac\u03b4\u03b5\u03b9\u03b3\u03bc\u03b1<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"javascript\" class=\"language-javascript\">const randomIntWrapper = (max) =&gt;\nFunctor(max)\n.map(increase) \/\/ max + 1\n.map(multiplyBy(Math.random())) \/\/ Math.random() * (max + 1)\n.map(Math.floor) \/\/ Math.floor(Math.random() * (max + 1))\n\nconst randomNumber = randomIntWrapper(200)\n\nrandomNumber.of() \/\/ \u03b5\u03c0\u03b9\u03c3\u03c4\u03c1\u03ad\u03c6\u03b5\u03b9 \u03b1\u03c1\u03b9\u03b8\u03bc\u03cc \u03bc\u03b5\u03c4\u03b1\u03be\u03cd 0 \u03ba\u03b1\u03b9 200\nrandomNumber.chain(decrease) \/\/ \u03b5\u03c0\u03b9\u03c3\u03c4\u03c1\u03ad\u03c6\u03b5\u03b9 (\u03b1\u03c1\u03b9\u03b8\u03bc\u03cc \u03bc\u03b5\u03c4\u03b1\u03be\u03cd 0 \u03ba\u03b1\u03b9 200) - 1<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">\u039c\u03bf\u03bd\u03ac\u03b4\u03b1<\/h2>\n\n\n\n<p>\u039c\u03b5\u03c1\u03b9\u03ba\u03ad\u03c2 \u03c6\u03bf\u03c1\u03ad\u03c2, \u03b5\u03ba\u03c4\u03cc\u03c2 \u03b1\u03c0\u03cc \u03c4\u03b9\u03c2 \u03c3\u03c5\u03bd\u03b1\u03c1\u03c4\u03ae\u03c3\u03b5\u03b9\u03c2 \u03c0\u03bf\u03c5 \u03b5\u03bd\u03b5\u03c1\u03b3\u03bf\u03c0\u03bf\u03b9\u03bf\u03cd\u03bd \u03c4\u03b7 \u03bd\u03ad\u03b1 \u03ba\u03b1\u03c4\u03ac\u03c3\u03c4\u03b1\u03c3\u03b7 \u03c4\u03b7\u03c2 \u03c4\u03b9\u03bc\u03ae\u03c2, \u03c7\u03c1\u03b5\u03b9\u03ac\u03b6\u03b5\u03c3\u03c4\u03b5 \u03c0\u03c1\u03cc\u03c3\u03b8\u03b5\u03c4\u03b7 \u03bb\u03bf\u03b3\u03b9\u03ba\u03ae \u03ba\u03c1\u03c5\u03bc\u03bc\u03ad\u03bd\u03b7 \u03c3\u03c4\u03bf \u03b4\u03bf\u03c7\u03b5\u03af\u03bf. \u03a3\u03b5 \u03b1\u03c5\u03c4\u03cc \u03c4\u03bf \u03c3\u03b7\u03bc\u03b5\u03af\u03bf \u03b7 \u03bc\u03bf\u03bd\u03ac\u03b4\u03b1 \u03b5\u03af\u03bd\u03b1\u03b9 \u03c7\u03c1\u03ae\u03c3\u03b9\u03bc\u03b7, \u03ba\u03b1\u03b8\u03ce\u03c2 \u03b5\u03af\u03bd\u03b1\u03b9 \u03bc\u03b9\u03b1 \u03b5\u03c0\u03ad\u03ba\u03c4\u03b1\u03c3\u03b7 \u03c4\u03b7\u03c2 <b>functor<\/b>. \u039c\u03c0\u03bf\u03c1\u03b5\u03af, \u03b3\u03b9\u03b1 \u03c0\u03b1\u03c1\u03ac\u03b4\u03b5\u03b9\u03b3\u03bc\u03b1, \u03bd\u03b1 \u03b1\u03c0\u03bf\u03c6\u03b1\u03c3\u03af\u03c3\u03b5\u03b9 \u03c4\u03b9 \u03c0\u03c1\u03ad\u03c0\u03b5\u03b9 \u03bd\u03b1 \u03c3\u03c5\u03bc\u03b2\u03b5\u03af \u03cc\u03c4\u03b1\u03bd \u03b7 \u03c4\u03b9\u03bc\u03ae \u03ad\u03c7\u03b5\u03b9 \u03bc\u03b9\u03b1 \u03c3\u03c5\u03b3\u03ba\u03b5\u03ba\u03c1\u03b9\u03bc\u03ad\u03bd\u03b7 \u03c4\u03b9\u03bc\u03ae \u03ae \u03c0\u03bf\u03b9\u03b1 \u03b5\u03af\u03bd\u03b1\u03b9 \u03b7 \u03c0\u03bf\u03c1\u03b5\u03af\u03b1 \u03c4\u03c9\u03bd \u03b5\u03c0\u03cc\u03bc\u03b5\u03bd\u03c9\u03bd \u03b5\u03bd\u03b5\u03c1\u03b3\u03b5\u03b9\u03ce\u03bd.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u039c\u03bf\u03bd\u03ac\u03b4\u03b1 \u038a\u03c3\u03c9\u03c2<\/h2>\n\n\n\n<p>\u0397 \u039c\u03bf\u03bd\u03ac\u03b4\u03b1 \u03af\u03c3\u03c9\u03c2 \u03bb\u03cd\u03bd\u03b5\u03b9 \u03c4\u03bf \u03c0\u03c1\u03cc\u03b2\u03bb\u03b7\u03bc\u03b1 \u03c4\u03c9\u03bd \u03c4\u03b9\u03bc\u03ce\u03bd \u03c0\u03bf\u03c5 \u03b5\u03c0\u03b9\u03c3\u03c4\u03c1\u03ad\u03c6\u03bf\u03c5\u03bd \u03bc\u03b7 \u03b1\u03bb\u03b7\u03b8\u03b5\u03af\u03c2. \u038c\u03c4\u03b1\u03bd \u03c3\u03c5\u03bc\u03b2\u03b1\u03af\u03bd\u03b5\u03b9 \u03b1\u03c5\u03c4\u03cc, \u03bf\u03b9 \u03b5\u03c0\u03cc\u03bc\u03b5\u03bd\u03b5\u03c2 <b>\u03c7\u03ac\u03c1\u03c4\u03b7\u03c2<\/b> \u03ba\u03bb\u03ae\u03c3\u03b5\u03b9\u03c2 \u03b1\u03b3\u03bd\u03bf\u03bf\u03cd\u03bd\u03c4\u03b1\u03b9, \u03b1\u03bb\u03bb\u03ac \u03c3\u03b1\u03c2 \u03b5\u03c0\u03b9\u03c4\u03c1\u03ad\u03c0\u03b5\u03b9 \u03bd\u03b1 \u03b5\u03c0\u03b9\u03c3\u03c4\u03c1\u03ad\u03c8\u03b5\u03c4\u03b5 \u03bc\u03b9\u03b1 \u03b5\u03bd\u03b1\u03bb\u03bb\u03b1\u03ba\u03c4\u03b9\u03ba\u03ae \u03ba\u03bb\u03ae\u03c3\u03b7 \u03ba\u03b1\u03bb\u03ce\u03bd\u03c4\u03b1\u03c2 \u03c4\u03b7\u03bd <b>getOr<\/b> \u03bc\u03ad\u03b8\u03bf\u03b4\u03bf\u03c2. \u03a3\u03b1\u03c2 \u03b5\u03c0\u03b9\u03c4\u03c1\u03ad\u03c0\u03b5\u03b9 \u03bd\u03b1 \u03b1\u03c0\u03bf\u03c6\u03cd\u03b3\u03b5\u03c4\u03b5 \u03c4\u03b7 \u03c7\u03c1\u03ae\u03c3\u03b7 \u03c4\u03c9\u03bd \u03c4\u03b5\u03bb\u03b5\u03c3\u03c4\u03ce\u03bd if \/ else, \u03bf\u03b9 \u03bf\u03c0\u03bf\u03af\u03bf\u03b9 \u03b5\u03af\u03bd\u03b1\u03b9 \u03b4\u03b7\u03bc\u03bf\u03c6\u03b9\u03bb\u03b5\u03af\u03c2 \u03c3\u03b5 <b>\u03c0\u03c1\u03bf\u03c3\u03c4\u03b1\u03ba\u03c4\u03b9\u03ba\u03ae<\/b> \u03c0\u03c1\u03bf\u03b3\u03c1\u03b1\u03bc\u03bc\u03b1\u03c4\u03b9\u03c3\u03bc\u03cc\u03c2. \u0391\u03c5\u03c4\u03ae \u03b7 \u03bc\u03bf\u03bd\u03ac\u03b4\u03b1 \u03b1\u03c0\u03bf\u03c4\u03b5\u03bb\u03b5\u03af\u03c4\u03b1\u03b9 \u03b1\u03c0\u03cc \u03c4\u03c1\u03af\u03b1 \u03b4\u03bf\u03c7\u03b5\u03af\u03b1:<\/p>\n\n\n\n<p><b>\u03a4\u03af\u03c0\u03bf\u03c4\u03b1<\/b> - \u03b5\u03ba\u03c4\u03b5\u03bb\u03b5\u03af\u03c4\u03b1\u03b9 \u03cc\u03c4\u03b1\u03bd \u03bc\u03b9\u03b1 \u03c4\u03b9\u03bc\u03ae \u03c0\u03bf\u03c5 \u03b4\u03b5\u03bd \u03b5\u03af\u03bd\u03b1\u03b9 \u03b1\u03bb\u03b7\u03b8\u03ae\u03c2 \u03c0\u03ad\u03c6\u03c4\u03b5\u03b9 \u03c3\u03c4\u03bf \u03b4\u03bf\u03c7\u03b5\u03af\u03bf \u03ae <strong>\u03c6\u03af\u03bb\u03c4\u03c1\u03bf<\/strong> \u03b7 \u03bc\u03ad\u03b8\u03bf\u03b4\u03bf\u03c2 \u03b5\u03c0\u03b9\u03c3\u03c4\u03c1\u03ad\u03c6\u03b5\u03b9 false. \u03a7\u03c1\u03b7\u03c3\u03b9\u03bc\u03bf\u03c0\u03bf\u03b9\u03b5\u03af\u03c4\u03b1\u03b9 \u03b3\u03b9\u03b1 \u03c4\u03b7\u03bd \u03c0\u03c1\u03bf\u03c3\u03bf\u03bc\u03bf\u03af\u03c9\u03c3\u03b7 \u03c4\u03b7\u03c2 \u03b5\u03ba\u03c4\u03ad\u03bb\u03b5\u03c3\u03b7\u03c2 \u03bc\u03b9\u03b1\u03c2 \u03c3\u03c5\u03bd\u03ac\u03c1\u03c4\u03b7\u03c3\u03b7\u03c2. \u0391\u03c5\u03c4\u03cc \u03c3\u03b7\u03bc\u03b1\u03af\u03bd\u03b5\u03b9 \u03cc\u03c4\u03b9 \u03b1\u03c5\u03c4\u03cc \u03c4\u03bf \u03b4\u03bf\u03c7\u03b5\u03af\u03bf \u03bb\u03b1\u03bc\u03b2\u03ac\u03bd\u03b5\u03b9 \u03c4\u03b7 \u03c3\u03c5\u03bd\u03ac\u03c1\u03c4\u03b7\u03c3\u03b7 \u03b1\u03bb\u03bb\u03ac \u03b4\u03b5\u03bd \u03c4\u03b7\u03bd \u03b5\u03ba\u03c4\u03b5\u03bb\u03b5\u03af.<\/p>\n\n\n\n<p><b>\u0391\u03c0\u03bb\u03ac<\/b> - \u03b1\u03c5\u03c4\u03cc \u03b5\u03af\u03bd\u03b1\u03b9 \u03c4\u03bf \u03ba\u03cd\u03c1\u03b9\u03bf \u03b4\u03bf\u03c7\u03b5\u03af\u03bf \u03c0\u03bf\u03c5 \u03b5\u03ba\u03c4\u03b5\u03bb\u03b5\u03af \u03cc\u03bb\u03b5\u03c2 \u03c4\u03b9\u03c2 \u03bb\u03b5\u03b9\u03c4\u03bf\u03c5\u03c1\u03b3\u03af\u03b5\u03c2, \u03b1\u03bb\u03bb\u03ac \u03b1\u03bd \u03b7 \u03c4\u03b9\u03bc\u03ae \u03b1\u03bb\u03bb\u03ac\u03be\u03b5\u03b9 \u03c3\u03b5 \u03c8\u03b5\u03c5\u03b4\u03ae \u03c4\u03b9\u03bc\u03ae \u03ae <b>\u03c6\u03af\u03bb\u03c4\u03c1\u03bf<\/b> \u03b5\u03c0\u03b9\u03c3\u03c4\u03c1\u03ad\u03c6\u03b5\u03b9 false, \u03b8\u03b1 \u03c4\u03bf \u03c0\u03b5\u03c1\u03ac\u03c3\u03b5\u03b9 \u03c3\u03c4\u03b7 \u03bc\u03ad\u03b8\u03bf\u03b4\u03bf <b>\u03a4\u03af\u03c0\u03bf\u03c4\u03b1<\/b> \u03b5\u03bc\u03c0\u03bf\u03c1\u03b5\u03c5\u03bc\u03b1\u03c4\u03bf\u03ba\u03b9\u03b2\u03ce\u03c4\u03b9\u03bf.<\/p>\n\n\n\n<p><b>\u038a\u03c3\u03c9\u03c2<\/b> - \u03a0\u03b1\u03af\u03c1\u03bd\u03c9 \u03c4\u03b7\u03bd \u03b1\u03c1\u03c7\u03b9\u03ba\u03ae \u03c4\u03b9\u03bc\u03ae \u03ba\u03b1\u03b9 \u03b1\u03c0\u03bf\u03c6\u03b1\u03c3\u03af\u03b6\u03c9 \u03c0\u03bf\u03b9\u03bf \u03b4\u03bf\u03c7\u03b5\u03af\u03bf \u03b8\u03b1 \u03ba\u03b1\u03bb\u03ad\u03c3\u03c9 \u03c3\u03c4\u03b7\u03bd \u03b1\u03c1\u03c7\u03ae.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">\u0394\u03ae\u03bb\u03c9\u03c3\u03b7<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"javascript\" class=\"language-javascript\">const Just = value =&gt; ({\nmap: fn =&gt; Maybe(fn(value)),\nchain: fn =&gt; fn(value),\nof: () =&gt; value,\ngetOr: () =&gt; value,\nfilter: fn =&gt; fn(value) ? Just(value) : Nothing(),\ntype: 'just'\n});\n\nconst Nothing = () =&gt; ({\nmap: fn =&gt; Nothing(),\nchain: fn =&gt; fn(),\nof: () =&gt; Nothing(),\ngetOr: substitute =&gt; substitute,\nfilter: () =&gt; Nothing(),\ntype: 'nothing'\n});\n\nconst Maybe = value =&gt;\nvalue === null || value === undefined || value.type === 'nothing'\n? Nothing()\n: Just(value)<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"\/app\/uploads\/2024\/05\/table.png\" alt=\"\u03bc\u03ad\u03b8\u03bf\u03b4\u03bf\u03b9 \u03c0\u03af\u03bd\u03b1\u03ba\u03b1 \u03bb\u03b5\u03b9\u03c4\u03bf\u03c5\u03c1\u03b3\u03cc\u03c2 \" title=\"\u03bb\u03b5\u03b9\u03c4\u03bf\u03c5\u03c1\u03b3\u03cc\u03c2 \u03c0\u03af\u03bd\u03b1\u03ba\u03b1 \"\/><\/figure>\n\n\n\n<p>\u03a4\u03ce\u03c1\u03b1 \u03b1\u03c2 \u03c6\u03c4\u03b9\u03ac\u03be\u03bf\u03c5\u03bc\u03b5 \u03c4\u03bf \u03c0\u03c1\u03bf\u03b7\u03b3\u03bf\u03cd\u03bc\u03b5\u03bd\u03bf \u03c0\u03b1\u03c1\u03ac\u03b4\u03b5\u03b9\u03b3\u03bc\u03b1 \u03c3\u03c7\u03b5\u03c4\u03b9\u03ba\u03ac \u03bc\u03b5 \u03c4\u03b7\u03bd \u03ba\u03b1\u03c4\u03ac\u03c3\u03c4\u03b1\u03c3\u03b7. \u0395\u03ac\u03bd \u03c4\u03bf max \u03b5\u03af\u03bd\u03b1\u03b9 \u03bc\u03b5\u03b3\u03b1\u03bb\u03cd\u03c4\u03b5\u03c1\u03bf \u03b1\u03c0\u03cc \u03c4\u03bf \u03bc\u03b7\u03b4\u03ad\u03bd, \u03b8\u03b1 \u03b5\u03ba\u03c4\u03b5\u03bb\u03b5\u03c3\u03c4\u03b5\u03af \u03b7 \u03c3\u03c5\u03bd\u03ac\u03c1\u03c4\u03b7\u03c3\u03b7. \u0394\u03b9\u03b1\u03c6\u03bf\u03c1\u03b5\u03c4\u03b9\u03ba\u03ac, \u03b8\u03b1 \u03b5\u03c0\u03b9\u03c3\u03c4\u03c1\u03ad\u03c8\u03b5\u03b9 0.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">\u0395\u03c0\u03b9\u03c4\u03b1\u03ba\u03c4\u03b9\u03ba\u03cc \u03c0\u03b1\u03c1\u03ac\u03b4\u03b5\u03b9\u03b3\u03bc\u03b1<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"javascript\" class=\"language-javascript\">const randomInt = (max) =&gt; {\nif(max &gt; 0) {\nreturn Math.floor(Math.random() * (max + 1))\n} else {\nreturn 0\n}\n}\n\nconst bookMiddlePage = 200\n\nconst randomPage = randomInt(10) || bookMiddlePage \/\/ \u03b5\u03c0\u03b9\u03c3\u03c4\u03c1\u03ad\u03c6\u03b5\u03b9 \u03c4\u03c5\u03c7\u03b1\u03af\u03b1\nconst randomPage = randomInt(-10) || bookMiddlePage \/\/ \u03b5\u03c0\u03b9\u03c3\u03c4\u03c1\u03ad\u03c6\u03b5\u03b9 200<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">\u0394\u03b7\u03bb\u03c9\u03c4\u03b9\u03ba\u03cc \u03c0\u03b1\u03c1\u03ac\u03b4\u03b5\u03b9\u03b3\u03bc\u03b1<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"javascript\" class=\"language-javascript\">const randomIntWrapper = (max) =&gt;\nMaybe(max)\n.filter(max =&gt; max &gt; 0) \/\/ \u03c4\u03b9\u03bc\u03ae false \u03b1\u03b3\u03bd\u03bf\u03b5\u03af \u03c0\u03b5\u03c1\u03b1\u03b9\u03c4\u03ad\u03c1\u03c9 \u03ba\u03bb\u03ae\u03c3\u03b5\u03b9\u03c2\n.map(increase)\n.map(multiplyBy(Math.random()))\n.map(Math.floor)\n\nconst bookMiddlePage = 200\n\n\/\/ \u0391\u03c0\u03bb\u03ac \u03b4\u03bf\u03c7\u03b5\u03af\u03bf\nconst randomPage = randomIntWrapper(10).getOr(bookMiddlePage) \/\/ \u03b5\u03c0\u03b9\u03c3\u03c4\u03c1\u03ad\u03c6\u03b5\u03b9 \u03c4\u03c5\u03c7\u03b1\u03af\u03b1\n\/\/ \u03a4\u03af\u03c0\u03bf\u03c4\u03b1 \u03b4\u03bf\u03c7\u03b5\u03af\u03bf\nconst randomPage = randomIntWrapper(-10).getOr(bookMiddlePage) \/\/ \u03b5\u03c0\u03b9\u03c3\u03c4\u03c1\u03ad\u03c6\u03b5\u03b9 200<\/code><\/pre>\n\n\n\n<p><br><a href=\"https:\/\/thecodest.co\/contact\"><img decoding=\"async\" src=\"\/app\/uploads\/2024\/05\/interested_in_cooperation_.png\" alt=\"\u03c0\u03b1\u03bd\u03cc \u03c3\u03c5\u03bd\u03b5\u03c1\u03b3\u03b1\u03c3\u03af\u03b1\u03c2\"><\/a><\/p>","protected":false},"excerpt":{"rendered":"<p>\u0395\u03bb\u03ad\u03b3\u03be\u03c4\u03b5 \u03c4\u03bf \u03c4\u03c1\u03af\u03c4\u03bf \u03bc\u03ad\u03c1\u03bf\u03c2 \u03c4\u03b7\u03c2 \u03c3\u03b5\u03b9\u03c1\u03ac\u03c2 \u03ac\u03c1\u03b8\u03c1\u03c9\u03bd \u0397 \u03b9\u03c3\u03c7\u03cd\u03c2 \u03c4\u03bf\u03c5 \u03bb\u03b5\u03b9\u03c4\u03bf\u03c5\u03c1\u03b3\u03b9\u03ba\u03bf\u03cd \u03c0\u03c1\u03bf\u03b3\u03c1\u03b1\u03bc\u03bc\u03b1\u03c4\u03b9\u03c3\u03bc\u03bf\u03cd \u03c3\u03c4\u03bf JavaScript. \u0391\u03c5\u03c4\u03ae \u03c4\u03b7 \u03c6\u03bf\u03c1\u03ac \u03bf \u03b5\u03b9\u03b4\u03b9\u03ba\u03cc\u03c2 \u03bc\u03b1\u03c2 \u03c3\u03c4\u03bf JavaScript \u03b5\u03be\u03b7\u03b3\u03b5\u03af \u03c0\u03b5\u03c1\u03b9\u03c3\u03c3\u03cc\u03c4\u03b5\u03c1\u03b1 \u03b3\u03b9\u03b1 \u03c4\u03bf\u03c5\u03c2 Functor \u03ba\u03b1\u03b9 Monad Maybe.<\/p>","protected":false},"author":2,"featured_media":3503,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"inline_featured_image":false,"footnotes":""},"categories":[8],"tags":[],"class_list":["post-3502","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-software-development"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v27.3 (Yoast SEO v27.3) - https:\/\/yoast.com\/product\/yoast-seo-premium-wordpress\/ -->\n<title>Functional programming in JavaScript Part 3 - Functor &amp; Monad Maybe - The Codest<\/title>\n<meta name=\"description\" content=\"Check the third part of our Power of functional programming in JavaScript article series. This time our JavaScript expert explains more about Functor and Monad Maybe.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/thecodest.co\/el\/blog\/\u03bb\u03b5\u03b9\u03c4\u03bf\u03c5\u03c1\u03b3\u03b9\u03ba\u03cc\u03c2-\u03c0\u03c1\u03bf\u03b3\u03c1\u03b1\u03bc\u03bc\u03b1\u03c4\u03b9\u03c3\u03bc\u03cc\u03c2-\u03c3\u03b5-javascript-\u03bc\u03ad\/\" \/>\n<meta property=\"og:locale\" content=\"el_GR\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Functional programming in JavaScript Part 3 - Functor &amp; Monad Maybe\" \/>\n<meta property=\"og:description\" content=\"Check the third part of our Power of functional programming in JavaScript article series. This time our JavaScript expert explains more about Functor and Monad Maybe.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/thecodest.co\/el\/blog\/\u03bb\u03b5\u03b9\u03c4\u03bf\u03c5\u03c1\u03b3\u03b9\u03ba\u03cc\u03c2-\u03c0\u03c1\u03bf\u03b3\u03c1\u03b1\u03bc\u03bc\u03b1\u03c4\u03b9\u03c3\u03bc\u03cc\u03c2-\u03c3\u03b5-javascript-\u03bc\u03ad\/\" \/>\n<meta property=\"og:site_name\" content=\"The Codest\" \/>\n<meta property=\"article:published_time\" content=\"2022-06-21T14:00:00+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2026-03-11T05:59:01+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/thecodest.co\/app\/uploads\/2024\/05\/power_of_functional_programming_in_javascript_part_3_-_functor_-_monad_maybe.png\" \/>\n\t<meta property=\"og:image:width\" content=\"960\" \/>\n\t<meta property=\"og:image:height\" content=\"540\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"thecodest\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"thecodest\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"3 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/thecodest.co\\\/blog\\\/functional-programming-in-javascript-part-3-functor-monad-maybe\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/thecodest.co\\\/blog\\\/functional-programming-in-javascript-part-3-functor-monad-maybe\\\/\"},\"author\":{\"name\":\"thecodest\",\"@id\":\"https:\\\/\\\/thecodest.co\\\/#\\\/schema\\\/person\\\/7e3fe41dfa4f4e41a7baad4c6e0d4f76\"},\"headline\":\"Functional programming in JavaScript Part 3 &#8211; Functor &#038; Monad Maybe\",\"datePublished\":\"2022-06-21T14:00:00+00:00\",\"dateModified\":\"2026-03-11T05:59:01+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/thecodest.co\\\/blog\\\/functional-programming-in-javascript-part-3-functor-monad-maybe\\\/\"},\"wordCount\":437,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/thecodest.co\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/thecodest.co\\\/blog\\\/functional-programming-in-javascript-part-3-functor-monad-maybe\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/thecodest.co\\\/app\\\/uploads\\\/2024\\\/05\\\/power_of_functional_programming_in_javascript_part_3_-_functor_-_monad_maybe.png\",\"articleSection\":[\"Software Development\"],\"inLanguage\":\"el\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/thecodest.co\\\/blog\\\/functional-programming-in-javascript-part-3-functor-monad-maybe\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/thecodest.co\\\/blog\\\/functional-programming-in-javascript-part-3-functor-monad-maybe\\\/\",\"url\":\"https:\\\/\\\/thecodest.co\\\/blog\\\/functional-programming-in-javascript-part-3-functor-monad-maybe\\\/\",\"name\":\"Functional programming in JavaScript Part 3 - Functor & Monad Maybe - The Codest\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/thecodest.co\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/thecodest.co\\\/blog\\\/functional-programming-in-javascript-part-3-functor-monad-maybe\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/thecodest.co\\\/blog\\\/functional-programming-in-javascript-part-3-functor-monad-maybe\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/thecodest.co\\\/app\\\/uploads\\\/2024\\\/05\\\/power_of_functional_programming_in_javascript_part_3_-_functor_-_monad_maybe.png\",\"datePublished\":\"2022-06-21T14:00:00+00:00\",\"dateModified\":\"2026-03-11T05:59:01+00:00\",\"description\":\"Check the third part of our Power of functional programming in JavaScript article series. This time our JavaScript expert explains more about Functor and Monad Maybe.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/thecodest.co\\\/blog\\\/functional-programming-in-javascript-part-3-functor-monad-maybe\\\/#breadcrumb\"},\"inLanguage\":\"el\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/thecodest.co\\\/blog\\\/functional-programming-in-javascript-part-3-functor-monad-maybe\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"el\",\"@id\":\"https:\\\/\\\/thecodest.co\\\/blog\\\/functional-programming-in-javascript-part-3-functor-monad-maybe\\\/#primaryimage\",\"url\":\"https:\\\/\\\/thecodest.co\\\/app\\\/uploads\\\/2024\\\/05\\\/power_of_functional_programming_in_javascript_part_3_-_functor_-_monad_maybe.png\",\"contentUrl\":\"https:\\\/\\\/thecodest.co\\\/app\\\/uploads\\\/2024\\\/05\\\/power_of_functional_programming_in_javascript_part_3_-_functor_-_monad_maybe.png\",\"width\":960,\"height\":540},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/thecodest.co\\\/blog\\\/functional-programming-in-javascript-part-3-functor-monad-maybe\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/thecodest.co\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Functional programming in JavaScript Part 3 &#8211; Functor &#038; Monad Maybe\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/thecodest.co\\\/#website\",\"url\":\"https:\\\/\\\/thecodest.co\\\/\",\"name\":\"The Codest\",\"description\":\"\",\"publisher\":{\"@id\":\"https:\\\/\\\/thecodest.co\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/thecodest.co\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"el\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/thecodest.co\\\/#organization\",\"name\":\"The Codest\",\"url\":\"https:\\\/\\\/thecodest.co\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"el\",\"@id\":\"https:\\\/\\\/thecodest.co\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/thecodest.co\\\/app\\\/uploads\\\/2024\\\/03\\\/thecodest-logo.svg\",\"contentUrl\":\"https:\\\/\\\/thecodest.co\\\/app\\\/uploads\\\/2024\\\/03\\\/thecodest-logo.svg\",\"width\":144,\"height\":36,\"caption\":\"The Codest\"},\"image\":{\"@id\":\"https:\\\/\\\/thecodest.co\\\/#\\\/schema\\\/logo\\\/image\\\/\"},\"sameAs\":[\"https:\\\/\\\/pl.linkedin.com\\\/company\\\/codest\",\"https:\\\/\\\/clutch.co\\\/profile\\\/codest\"]},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/thecodest.co\\\/#\\\/schema\\\/person\\\/7e3fe41dfa4f4e41a7baad4c6e0d4f76\",\"name\":\"thecodest\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"el\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/5dbfe6a1e8c86e432e8812759e34e6fe82ebac75119ae3237a6c1311fa19caf4?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/5dbfe6a1e8c86e432e8812759e34e6fe82ebac75119ae3237a6c1311fa19caf4?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/5dbfe6a1e8c86e432e8812759e34e6fe82ebac75119ae3237a6c1311fa19caf4?s=96&d=mm&r=g\",\"caption\":\"thecodest\"},\"url\":\"https:\\\/\\\/thecodest.co\\\/el\\\/author\\\/thecodest\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"\u039b\u03b5\u03b9\u03c4\u03bf\u03c5\u03c1\u03b3\u03b9\u03ba\u03cc\u03c2 \u03c0\u03c1\u03bf\u03b3\u03c1\u03b1\u03bc\u03bc\u03b1\u03c4\u03b9\u03c3\u03bc\u03cc\u03c2 \u03c3\u03b5 JavaScript \u039c\u03ad\u03c1\u03bf\u03c2 3 - Functor &amp; Monad Maybe - The Codest","description":"\u0395\u03bb\u03ad\u03b3\u03be\u03c4\u03b5 \u03c4\u03bf \u03c4\u03c1\u03af\u03c4\u03bf \u03bc\u03ad\u03c1\u03bf\u03c2 \u03c4\u03b7\u03c2 \u03c3\u03b5\u03b9\u03c1\u03ac\u03c2 \u03ac\u03c1\u03b8\u03c1\u03c9\u03bd \u0397 \u03b9\u03c3\u03c7\u03cd\u03c2 \u03c4\u03bf\u03c5 \u03bb\u03b5\u03b9\u03c4\u03bf\u03c5\u03c1\u03b3\u03b9\u03ba\u03bf\u03cd \u03c0\u03c1\u03bf\u03b3\u03c1\u03b1\u03bc\u03bc\u03b1\u03c4\u03b9\u03c3\u03bc\u03bf\u03cd \u03c3\u03c4\u03bf JavaScript. \u0391\u03c5\u03c4\u03ae \u03c4\u03b7 \u03c6\u03bf\u03c1\u03ac \u03bf \u03b5\u03b9\u03b4\u03b9\u03ba\u03cc\u03c2 \u03bc\u03b1\u03c2 \u03c3\u03c4\u03bf JavaScript \u03b5\u03be\u03b7\u03b3\u03b5\u03af \u03c0\u03b5\u03c1\u03b9\u03c3\u03c3\u03cc\u03c4\u03b5\u03c1\u03b1 \u03b3\u03b9\u03b1 \u03c4\u03bf\u03c5\u03c2 Functor \u03ba\u03b1\u03b9 Monad Maybe.","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:\/\/thecodest.co\/el\/blog\/\u03bb\u03b5\u03b9\u03c4\u03bf\u03c5\u03c1\u03b3\u03b9\u03ba\u03cc\u03c2-\u03c0\u03c1\u03bf\u03b3\u03c1\u03b1\u03bc\u03bc\u03b1\u03c4\u03b9\u03c3\u03bc\u03cc\u03c2-\u03c3\u03b5-javascript-\u03bc\u03ad\/","og_locale":"el_GR","og_type":"article","og_title":"Functional programming in JavaScript Part 3 - Functor & Monad Maybe","og_description":"Check the third part of our Power of functional programming in JavaScript article series. This time our JavaScript expert explains more about Functor and Monad Maybe.","og_url":"https:\/\/thecodest.co\/el\/blog\/\u03bb\u03b5\u03b9\u03c4\u03bf\u03c5\u03c1\u03b3\u03b9\u03ba\u03cc\u03c2-\u03c0\u03c1\u03bf\u03b3\u03c1\u03b1\u03bc\u03bc\u03b1\u03c4\u03b9\u03c3\u03bc\u03cc\u03c2-\u03c3\u03b5-javascript-\u03bc\u03ad\/","og_site_name":"The Codest","article_published_time":"2022-06-21T14:00:00+00:00","article_modified_time":"2026-03-11T05:59:01+00:00","og_image":[{"width":960,"height":540,"url":"https:\/\/thecodest.co\/app\/uploads\/2024\/05\/power_of_functional_programming_in_javascript_part_3_-_functor_-_monad_maybe.png","type":"image\/png"}],"author":"thecodest","twitter_card":"summary_large_image","twitter_misc":{"Written by":"thecodest","Est. reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/thecodest.co\/blog\/functional-programming-in-javascript-part-3-functor-monad-maybe\/#article","isPartOf":{"@id":"https:\/\/thecodest.co\/blog\/functional-programming-in-javascript-part-3-functor-monad-maybe\/"},"author":{"name":"thecodest","@id":"https:\/\/thecodest.co\/#\/schema\/person\/7e3fe41dfa4f4e41a7baad4c6e0d4f76"},"headline":"Functional programming in JavaScript Part 3 &#8211; Functor &#038; Monad Maybe","datePublished":"2022-06-21T14:00:00+00:00","dateModified":"2026-03-11T05:59:01+00:00","mainEntityOfPage":{"@id":"https:\/\/thecodest.co\/blog\/functional-programming-in-javascript-part-3-functor-monad-maybe\/"},"wordCount":437,"commentCount":0,"publisher":{"@id":"https:\/\/thecodest.co\/#organization"},"image":{"@id":"https:\/\/thecodest.co\/blog\/functional-programming-in-javascript-part-3-functor-monad-maybe\/#primaryimage"},"thumbnailUrl":"https:\/\/thecodest.co\/app\/uploads\/2024\/05\/power_of_functional_programming_in_javascript_part_3_-_functor_-_monad_maybe.png","articleSection":["Software Development"],"inLanguage":"el","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/thecodest.co\/blog\/functional-programming-in-javascript-part-3-functor-monad-maybe\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/thecodest.co\/blog\/functional-programming-in-javascript-part-3-functor-monad-maybe\/","url":"https:\/\/thecodest.co\/blog\/functional-programming-in-javascript-part-3-functor-monad-maybe\/","name":"\u039b\u03b5\u03b9\u03c4\u03bf\u03c5\u03c1\u03b3\u03b9\u03ba\u03cc\u03c2 \u03c0\u03c1\u03bf\u03b3\u03c1\u03b1\u03bc\u03bc\u03b1\u03c4\u03b9\u03c3\u03bc\u03cc\u03c2 \u03c3\u03b5 JavaScript \u039c\u03ad\u03c1\u03bf\u03c2 3 - Functor &amp; Monad Maybe - The Codest","isPartOf":{"@id":"https:\/\/thecodest.co\/#website"},"primaryImageOfPage":{"@id":"https:\/\/thecodest.co\/blog\/functional-programming-in-javascript-part-3-functor-monad-maybe\/#primaryimage"},"image":{"@id":"https:\/\/thecodest.co\/blog\/functional-programming-in-javascript-part-3-functor-monad-maybe\/#primaryimage"},"thumbnailUrl":"https:\/\/thecodest.co\/app\/uploads\/2024\/05\/power_of_functional_programming_in_javascript_part_3_-_functor_-_monad_maybe.png","datePublished":"2022-06-21T14:00:00+00:00","dateModified":"2026-03-11T05:59:01+00:00","description":"\u0395\u03bb\u03ad\u03b3\u03be\u03c4\u03b5 \u03c4\u03bf \u03c4\u03c1\u03af\u03c4\u03bf \u03bc\u03ad\u03c1\u03bf\u03c2 \u03c4\u03b7\u03c2 \u03c3\u03b5\u03b9\u03c1\u03ac\u03c2 \u03ac\u03c1\u03b8\u03c1\u03c9\u03bd \u0397 \u03b9\u03c3\u03c7\u03cd\u03c2 \u03c4\u03bf\u03c5 \u03bb\u03b5\u03b9\u03c4\u03bf\u03c5\u03c1\u03b3\u03b9\u03ba\u03bf\u03cd \u03c0\u03c1\u03bf\u03b3\u03c1\u03b1\u03bc\u03bc\u03b1\u03c4\u03b9\u03c3\u03bc\u03bf\u03cd \u03c3\u03c4\u03bf JavaScript. \u0391\u03c5\u03c4\u03ae \u03c4\u03b7 \u03c6\u03bf\u03c1\u03ac \u03bf \u03b5\u03b9\u03b4\u03b9\u03ba\u03cc\u03c2 \u03bc\u03b1\u03c2 \u03c3\u03c4\u03bf JavaScript \u03b5\u03be\u03b7\u03b3\u03b5\u03af \u03c0\u03b5\u03c1\u03b9\u03c3\u03c3\u03cc\u03c4\u03b5\u03c1\u03b1 \u03b3\u03b9\u03b1 \u03c4\u03bf\u03c5\u03c2 Functor \u03ba\u03b1\u03b9 Monad Maybe.","breadcrumb":{"@id":"https:\/\/thecodest.co\/blog\/functional-programming-in-javascript-part-3-functor-monad-maybe\/#breadcrumb"},"inLanguage":"el","potentialAction":[{"@type":"ReadAction","target":["https:\/\/thecodest.co\/blog\/functional-programming-in-javascript-part-3-functor-monad-maybe\/"]}]},{"@type":"ImageObject","inLanguage":"el","@id":"https:\/\/thecodest.co\/blog\/functional-programming-in-javascript-part-3-functor-monad-maybe\/#primaryimage","url":"https:\/\/thecodest.co\/app\/uploads\/2024\/05\/power_of_functional_programming_in_javascript_part_3_-_functor_-_monad_maybe.png","contentUrl":"https:\/\/thecodest.co\/app\/uploads\/2024\/05\/power_of_functional_programming_in_javascript_part_3_-_functor_-_monad_maybe.png","width":960,"height":540},{"@type":"BreadcrumbList","@id":"https:\/\/thecodest.co\/blog\/functional-programming-in-javascript-part-3-functor-monad-maybe\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/thecodest.co\/"},{"@type":"ListItem","position":2,"name":"Functional programming in JavaScript Part 3 &#8211; Functor &#038; Monad Maybe"}]},{"@type":"WebSite","@id":"https:\/\/thecodest.co\/#website","url":"https:\/\/thecodest.co\/","name":"The Codest","description":"","publisher":{"@id":"https:\/\/thecodest.co\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/thecodest.co\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"el"},{"@type":"Organization","@id":"https:\/\/thecodest.co\/#organization","name":"The Codest","url":"https:\/\/thecodest.co\/","logo":{"@type":"ImageObject","inLanguage":"el","@id":"https:\/\/thecodest.co\/#\/schema\/logo\/image\/","url":"https:\/\/thecodest.co\/app\/uploads\/2024\/03\/thecodest-logo.svg","contentUrl":"https:\/\/thecodest.co\/app\/uploads\/2024\/03\/thecodest-logo.svg","width":144,"height":36,"caption":"The Codest"},"image":{"@id":"https:\/\/thecodest.co\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/pl.linkedin.com\/company\/codest","https:\/\/clutch.co\/profile\/codest"]},{"@type":"Person","@id":"https:\/\/thecodest.co\/#\/schema\/person\/7e3fe41dfa4f4e41a7baad4c6e0d4f76","name":"thecodest","image":{"@type":"ImageObject","inLanguage":"el","@id":"https:\/\/secure.gravatar.com\/avatar\/5dbfe6a1e8c86e432e8812759e34e6fe82ebac75119ae3237a6c1311fa19caf4?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/5dbfe6a1e8c86e432e8812759e34e6fe82ebac75119ae3237a6c1311fa19caf4?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/5dbfe6a1e8c86e432e8812759e34e6fe82ebac75119ae3237a6c1311fa19caf4?s=96&d=mm&r=g","caption":"thecodest"},"url":"https:\/\/thecodest.co\/el\/author\/thecodest\/"}]}},"_links":{"self":[{"href":"https:\/\/thecodest.co\/el\/wp-json\/wp\/v2\/posts\/3502","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/thecodest.co\/el\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/thecodest.co\/el\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/thecodest.co\/el\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/thecodest.co\/el\/wp-json\/wp\/v2\/comments?post=3502"}],"version-history":[{"count":8,"href":"https:\/\/thecodest.co\/el\/wp-json\/wp\/v2\/posts\/3502\/revisions"}],"predecessor-version":[{"id":8386,"href":"https:\/\/thecodest.co\/el\/wp-json\/wp\/v2\/posts\/3502\/revisions\/8386"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/thecodest.co\/el\/wp-json\/wp\/v2\/media\/3503"}],"wp:attachment":[{"href":"https:\/\/thecodest.co\/el\/wp-json\/wp\/v2\/media?parent=3502"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/thecodest.co\/el\/wp-json\/wp\/v2\/categories?post=3502"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/thecodest.co\/el\/wp-json\/wp\/v2\/tags?post=3502"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}