{"id":67605,"date":"2024-06-27T06:29:57","date_gmt":"2024-06-27T02:59:57","guid":{"rendered":"https:\/\/nabfollower.com\/blog\/software-design-using-oop-fp-part-1-2fgh\/"},"modified":"2024-06-27T06:29:57","modified_gmt":"2024-06-27T02:59:57","slug":"software-design-using-oop-fp-part-1-2fgh","status":"publish","type":"post","link":"https:\/\/nabfollower.com\/blog\/software-design-using-oop-fp-part-1-2fgh\/","title":{"rendered":"\u0637\u0631\u0627\u062d\u06cc \u0646\u0631\u0645 \u0627\u0641\u0632\u0627\u0631 \u0628\u0627 \u0627\u0633\u062a\u0641\u0627\u062f\u0647 \u0627\u0632 OOP + FP &#8211; \u0642\u0633\u0645\u062a 1"},"content":{"rendered":"<p>Summarize this content to 400 words in Persian Lang <\/p>\n<p>  \u0637\u0631\u0627\u062d\u06cc \u0646\u0631\u0645 \u0627\u0641\u0632\u0627\u0631 \u0628\u0627 \u0627\u0633\u062a\u0641\u0627\u062f\u0647 \u0627\u0632 OOP + FP &#8211; \u0642\u0633\u0645\u062a 1<\/p>\n<p>\u0628\u06cc\u0627\u06cc\u06cc\u062f \u0631\u0627\u0647 \u062d\u0644 \u0647\u0627\u06cc \u062f\u06cc\u0648\u0627\u0646\u0647 \u06a9\u0646\u0646\u062f\u0647 \u0627\u06cc \u0631\u0627 \u0628\u0627 \u062a\u0631\u06a9\u06cc\u0628 OOP \u0648 FP \u0627\u0646\u062c\u0627\u0645 \u062f\u0647\u06cc\u0645 \ud83d\ude42<\/p>\n<p>\u0627\u06cc\u062f\u0647 \u0627\u06cc\u0646 \u0645\u0642\u0627\u0644\u0647 \u0627\u06cc\u0646 \u0627\u0633\u062a \u06a9\u0647 \u0686\u0646\u062f\u06cc\u0646 \u0627\u0644\u06af\u0648 \u0631\u0627 \u062e\u0644\u0627\u0635\u0647 \u06a9\u0646\u062f \u0648 \u0645\u062b\u0627\u0644 \u0647\u0627\u06cc\u06cc \u0627\u0632 \u0646\u062d\u0648\u0647 \u062d\u0644 \u0645\u0648\u0627\u0631\u062f \u062e\u0627\u0635 \u0628\u0627 \u0627\u0633\u062a\u0641\u0627\u062f\u0647 \u0627\u0632 \u0628\u0631\u0646\u0627\u0645\u0647 \u0646\u0648\u06cc\u0633\u06cc \u0634\u06cc \u06af\u0631\u0627 \u0627\u0631\u0627\u0626\u0647 \u062f\u0647\u062f.OOP) \u0648 \u0628\u0631\u0646\u0627\u0645\u0647 \u0646\u0648\u06cc\u0633\u06cc \u062a\u0627\u0628\u0639\u06cc (FP) \u0628\u0631\u0627\u06cc \u0628\u0647 \u062f\u0633\u062a \u0622\u0648\u0631\u062f\u0646 \u0631\u0627\u0647 \u062d\u0644 \u0647\u0627\u06cc \u0628\u0647\u062a\u0631.<\/p>\n<p>\u062f\u0631 \u0637\u0648\u0644 \u0632\u0646\u062f\u06af\u06cc \u062d\u0631\u0641\u0647 \u0627\u06cc \u062e\u0648\u062f\u060c \u0645\u06cc \u062a\u0648\u0627\u0646\u06cc\u0645 \u0628\u06cc\u0646 \u067e\u0627\u0631\u0627\u062f\u0627\u06cc\u0645 \u0647\u0627\u06cc \u0628\u0631\u0646\u0627\u0645\u0647 \u0646\u0648\u06cc\u0633\u06cc \u0645\u062e\u062a\u0644\u0641 \u062d\u0631\u06a9\u062a \u06a9\u0646\u06cc\u0645.  \u0647\u0631 \u06a9\u062f\u0627\u0645 \u0646\u0642\u0627\u0637 \u0642\u0648\u062a \u0648 \u0636\u0639\u0641 \u062e\u0648\u062f \u0631\u0627 \u062f\u0627\u0631\u0646\u062f \u0648 \u0628\u06cc\u0634 \u0627\u0632 \u062f\u0648 \u0645\u0648\u0631\u062f \u0648\u062c\u0648\u062f \u062f\u0627\u0631\u062f.  \u0645\u0627 OOP \u0648 FP \u0631\u0627 \u0628\u0631\u0631\u0633\u06cc \u062e\u0648\u0627\u0647\u06cc\u0645 \u06a9\u0631\u062f \u0632\u06cc\u0631\u0627 \u0622\u0646\u0647\u0627 \u0628\u06cc\u0634\u062a\u0631\u06cc\u0646 \u0627\u0633\u062a\u0641\u0627\u062f\u0647 \u0631\u0627 \u062f\u0627\u0631\u0646\u062f.  \u0646\u06a9\u062a\u0647 \u06a9\u0644\u06cc\u062f\u06cc \u0647\u0645\u06cc\u0634\u0647 \u0627\u06cc\u0646 \u0627\u0633\u062a \u06a9\u0647 \u0628\u062f\u0627\u0646\u06cc\u062f \u0686\u0647 \u0632\u0645\u0627\u0646\u06cc \u0648 \u0686\u06af\u0648\u0646\u0647 \u0647\u0631 \u06a9\u062f\u0627\u0645 \u0631\u0627 \u0628\u0631\u0627\u06cc \u0628\u0647 \u062f\u0633\u062a \u0622\u0648\u0631\u062f\u0646 \u0631\u0627\u0647 \u062d\u0644 \u0647\u0627\u06cc \u0628\u0647\u062a\u0631 \u0627\u0639\u0645\u0627\u0644 \u06a9\u0646\u06cc\u062f.<\/p>\n<p>\u0628\u06cc\u0627\u06cc\u06cc\u062f \u06cc\u06a9 \u0628\u0631\u0631\u0633\u06cc \u0633\u0631\u06cc\u0639 \u0627\u0632 \u0627\u06cc\u062f\u0647 \u0647\u0627\/\u0645\u0641\u0627\u0647\u06cc\u0645 \u0627\u0635\u0644\u06cc \u0647\u0631 \u067e\u0627\u0631\u0627\u062f\u0627\u06cc\u0645 \u062f\u0627\u0634\u062a\u0647 \u0628\u0627\u0634\u06cc\u0645<\/p>\n<p>  \u0648\u06cc\u0698\u06af\u06cc \u0647\u0627\u06cc \u0628\u0631\u0646\u0627\u0645\u0647 \u0646\u0648\u06cc\u0633\u06cc \u0634\u06cc \u06af\u0631\u0627<\/p>\n<p>\u06a9\u067e\u0633\u0648\u0644\u0647 \u0633\u0627\u0632\u06cc: \u067e\u0646\u0647\u0627\u0646 \u06a9\u0631\u062f\u0646 \u062c\u0632\u0626\u06cc\u0627\u062a \u062f\u0627\u062e\u0644\u06cc \u0648 \u0627\u0641\u0634\u0627\u06cc \u062a\u0646\u0647\u0627 \u0645\u0648\u0627\u0631\u062f \u0636\u0631\u0648\u0631\u06cc.<br \/>\n\u0648\u0631\u0627\u062b\u062a: \u0627\u06cc\u062c\u0627\u062f \u06a9\u0644\u0627\u0633 \u0647\u0627\u06cc \u062c\u062f\u06cc\u062f \u0628\u0631 \u0627\u0633\u0627\u0633 \u06a9\u0644\u0627\u0633 \u0647\u0627\u06cc \u0645\u0648\u062c\u0648\u062f.<br \/>\n\u067e\u0644\u06cc \u0645\u0648\u0631\u0641\u06cc\u0633\u0645: \u06a9\u0644\u0627\u0633 \u0647\u0627\u06cc \u0645\u062e\u062a\u0644\u0641 \u0631\u0627 \u0645\u06cc \u062a\u0648\u0627\u0646 \u0627\u0632 \u0637\u0631\u06cc\u0642 \u06cc\u06a9 \u0631\u0627\u0628\u0637 \u0645\u0634\u062a\u0631\u06a9 \u062f\u0631\u0645\u0627\u0646 \u06a9\u0631\u062f.<br \/>\n\u0627\u0646\u062a\u0632\u0627\u0639 &#8211; \u0645\u0641\u0647\u0648\u0645 &#8211; \u0628\u0631\u062f\u0627\u0634\u062a: \u0633\u0627\u062f\u0647 \u0633\u0627\u0632\u06cc \u0633\u06cc\u0633\u062a\u0645 \u0647\u0627\u06cc \u067e\u06cc\u0686\u06cc\u062f\u0647 \u0628\u0627 \u067e\u0646\u0647\u0627\u0646 \u06a9\u0631\u062f\u0646 \u062c\u0632\u0626\u06cc\u0627\u062a \u063a\u06cc\u0631 \u0636\u0631\u0648\u0631\u06cc.<br \/>\n\u0635\u062d\u0627\u0641\u06cc \u067e\u0648\u06cc\u0627: \u062a\u0639\u06cc\u06cc\u0646 \u0627\u06cc\u0646\u06a9\u0647 \u06a9\u062f\u0627\u0645 \u0645\u062a\u062f \u062f\u0631 \u0632\u0645\u0627\u0646 \u0627\u062c\u0631\u0627 \u0628\u0647 \u062c\u0627\u06cc \u0632\u0645\u0627\u0646 \u06a9\u0627\u0645\u067e\u0627\u06cc\u0644 \u0641\u0631\u0627\u062e\u0648\u0627\u0646\u06cc \u0634\u0648\u062f.<br \/>\n\u0627\u0631\u0633\u0627\u0644 \u067e\u06cc\u0627\u0645: \u0627\u0634\u06cc\u0627 \u0628\u0627 \u0627\u0631\u0633\u0627\u0644 \u0648 \u062f\u0631\u06cc\u0627\u0641\u062a \u067e\u06cc\u0627\u0645 \u0628\u0627 \u06cc\u06a9\u062f\u06cc\u06af\u0631 \u0627\u0631\u062a\u0628\u0627\u0637 \u0628\u0631\u0642\u0631\u0627\u0631 \u0645\u06cc \u06a9\u0646\u0646\u062f.<\/p>\n<p>  \u0648\u06cc\u0698\u06af\u06cc \u0647\u0627\u06cc \u0628\u0631\u0646\u0627\u0645\u0647 \u0646\u0648\u06cc\u0633\u06cc \u06a9\u0627\u0631\u0628\u0631\u062f\u06cc<\/p>\n<p>\u062a\u063a\u06cc\u06cc\u0631\u0646\u0627\u067e\u0630\u06cc\u0631\u06cc: \u062f\u0627\u062f\u0647 \u0647\u0627 \u067e\u0633 \u0627\u0632 \u0627\u06cc\u062c\u0627\u062f \u062a\u063a\u06cc\u06cc\u0631 \u0646\u0645\u06cc \u06a9\u0646\u0646\u062f.<br \/>\n\u062a\u0648\u0627\u0628\u0639 \u062e\u0627\u0644\u0635: \u0647\u0645\u06cc\u0634\u0647 \u06cc\u06a9 \u0646\u062a\u06cc\u062c\u0647 \u0631\u0627 \u0628\u0631\u0627\u06cc \u0648\u0631\u0648\u062f\u06cc \u0647\u0627\u06cc \u06cc\u06a9\u0633\u0627\u0646 \u0628\u0631\u06af\u0631\u062f\u0627\u0646\u06cc\u062f.<br \/>\n\u062a\u0631\u06a9\u06cc\u0628 \u062a\u0627\u0628\u0639: \u062a\u0631\u06a9\u06cc\u0628 \u062a\u0648\u0627\u0628\u0639 \u0633\u0627\u062f\u0647 \u0628\u0631\u0627\u06cc \u0627\u06cc\u062c\u0627\u062f \u062a\u0648\u0627\u0628\u0639 \u067e\u06cc\u0686\u06cc\u062f\u0647 \u062a\u0631.<br \/>\n\u0628\u0627\u0632\u06af\u0634\u062a: \u062d\u0644 \u0645\u0633\u0627\u0626\u0644 \u0628\u0627 \u062a\u0642\u0633\u06cc\u0645 \u06a9\u0631\u062f\u0646 \u0622\u0646\u0647\u0627 \u0628\u0647 \u0645\u0648\u0627\u0631\u062f \u06a9\u0648\u0686\u06a9\u062a\u0631 \u0647\u0645\u0627\u0646 \u0645\u0634\u06a9\u0644.<br \/>\n\u0646\u0638\u0645 \u0628\u0627\u0644\u0627: \u062a\u0648\u0627\u0628\u0639\u06cc \u06a9\u0647 \u062a\u0648\u0627\u0628\u0639 \u062f\u06cc\u06af\u0631 \u0631\u0627 \u0628\u0647 \u0639\u0646\u0648\u0627\u0646 \u0622\u0631\u06af\u0648\u0645\u0627\u0646 \u0645\u06cc \u06af\u06cc\u0631\u0646\u062f \u06cc\u0627 \u062a\u0648\u0627\u0628\u0639 \u0631\u0627 \u0628\u0647 \u0639\u0646\u0648\u0627\u0646 \u0646\u062a\u06cc\u062c\u0647 \u0628\u0631\u0645\u06cc \u06af\u0631\u062f\u0646\u062f.<br \/>\n\u0634\u0641\u0627\u0641\u06cc\u062a \u0627\u0631\u062c\u0627\u0639\u06cc: \u06cc\u06a9 \u0639\u0628\u0627\u0631\u062a \u0631\u0627 \u0645\u06cc \u062a\u0648\u0627\u0646 \u0628\u062f\u0648\u0646 \u062a\u063a\u06cc\u06cc\u0631 \u062f\u0631 \u0631\u0641\u062a\u0627\u0631 \u0628\u0631\u0646\u0627\u0645\u0647 \u0628\u0627 \u0645\u0642\u062f\u0627\u0631 \u0622\u0646 \u062c\u0627\u06cc\u06af\u0632\u06cc\u0646 \u06a9\u0631\u062f.<\/p>\n<p>\u0627\u06a9\u0646\u0648\u0646 \u06a9\u0647 \u0645\u0648\u0636\u0648\u0639\u0627\u062a \u067e\u0627\u0631\u0627\u062f\u0627\u06cc\u0645 \u0647\u0627\u06cc \u0627\u0635\u0644\u06cc \u0631\u0627 \u0645\u0631\u0648\u0631 \u06a9\u0631\u062f\u06cc\u0645\u060c \u0622\u0645\u0627\u062f\u0647 \u0628\u0631\u0631\u0633\u06cc \u0628\u0631\u062e\u06cc \u0627\u0632 \u0627\u0644\u06af\u0648\u0647\u0627\u06cc \u0628\u0648\u06cc \u0631\u0627\u06cc\u062c \u0647\u0633\u062a\u06cc\u0645\u060c \u0627\u0645\u0627 \u0642\u0628\u0644 \u0627\u0632 \u0622\u0646\u060c \u0645\u06cc \u062e\u0648\u0627\u0647\u0645 \u0645\u0642\u062f\u0645\u0627\u062a \u0628\u0631\u062a\u0631 \u062e\u0648\u062f \u0631\u0627 \u0647\u0646\u06af\u0627\u0645 \u06a9\u062f\u0646\u0648\u06cc\u0633\u06cc \u0627\u0631\u0627\u0626\u0647 \u06a9\u0646\u0645.<\/p>\n<p>\u0645\u0642\u062f\u0627\u0631 \u0646\u062d\u0648 \u0627\u0633\u062a\u0641\u0627\u062f\u0647 \u0634\u062f\u0647 \u0631\u0627 (\u062a\u0627 \u062d\u062f \u0627\u0645\u06a9\u0627\u0646) \u0628\u0647 \u062d\u062f\u0627\u0642\u0644 \u0628\u0631\u0633\u0627\u0646\u06cc\u062f.<br \/>\n\u0627\u0632 \u062a\u0639\u0631\u06cc\u0641 \u067e\u0627\u0631\u0627\u0645\u062a\u0631\u0647\u0627\u06cc \u063a\u06cc\u0631 \u0636\u0631\u0648\u0631\u06cc \u062e\u0648\u062f\u062f\u0627\u0631\u06cc \u06a9\u0646\u06cc\u062f.<br \/>\n\u062a\u0648\u0627\u0628\u0639\/\u0631\u0648\u0634 \u0647\u0627 \u0631\u0627 \u06a9\u0648\u0686\u06a9 \u0646\u06af\u0647 \u062f\u0627\u0631\u06cc\u062f \u0648 \u0631\u0648\u06cc \u062a\u06a9 \u0645\u0646\u0638\u0648\u0631\u0647 \u0645\u062a\u0645\u0631\u06a9\u0632 \u06a9\u0646\u06cc\u062f (\u062f\u0631 \u0635\u0648\u0631\u062a \u0627\u0645\u06a9\u0627\u0646 \u062f\u0631\u0648\u0646 \u062e\u0637\u06cc).<br \/>\n\u0637\u0631\u0627\u062d\u06cc \u0628\u0627 \u0627\u0633\u062a\u0641\u0627\u062f\u0647 \u0627\u0632 \u062a\u063a\u06cc\u06cc\u0631 \u0646\u0627\u067e\u0630\u06cc\u0631\u06cc \u0648 \u062a\u063a\u06cc\u06cc\u0631\u067e\u0630\u06cc\u0631\u06cc \u062a\u0631\u06a9 \u0641\u0642\u0637 \u0628\u0631\u0627\u06cc \u0645\u0648\u0627\u0631\u062f \u062e\u0627\u0635 (\u06a9\u067e\u0633\u0648\u0644\u0647 \u0634\u062f\u0647).<br \/>\n\u0627\u0632 \u0646\u0627\u0645 \u0647\u0627\u06cc \u062a\u0648\u0635\u06cc\u0641\u06cc \u0628\u0631\u0627\u06cc \u062a\u0648\u0627\u0628\u0639\u060c \u0645\u062a\u062f\u0647\u0627\u060c \u06a9\u0644\u0627\u0633 \u0647\u0627 \u0648 \u062b\u0627\u0628\u062a \u0647\u0627 \u0627\u0633\u062a\u0641\u0627\u062f\u0647 \u06a9\u0646\u06cc\u062f.<br \/>\n\u0627\u0632 \u0627\u0633\u062a\u0641\u0627\u062f\u0647 \u0627\u0632 \u06a9\u0644\u0645\u0627\u062a \u06a9\u0644\u06cc\u062f\u06cc \u062a\u06a9\u0631\u0627\u0631 \u062f\u0627\u062e\u0644\u06cc \u062e\u0648\u062f\u062f\u0627\u0631\u06cc \u06a9\u0646\u06cc\u062f (\u0645\u06af\u0631 \u0627\u06cc\u0646\u06a9\u0647 \u0627\u0633\u062a\u0641\u0627\u062f\u0647 \u0627\u0632 \u06cc\u06a9 \u062a\u0627\u0628\u0639 \u0645\u0631\u062a\u0628\u0647 \u0628\u0627\u0644\u0627 \u0631\u0627\u0647 \u062d\u0644 \u0631\u0627 \u0628\u062f\u062a\u0631 \u06a9\u0646\u062f).<br \/>\n\u0647\u0632\u06cc\u0646\u0647 \u0645\u062d\u0627\u0633\u0628\u0627\u062a\u06cc \u0631\u0627 \u0647\u0645\u06cc\u0634\u0647 \u062f\u0631 \u0646\u0638\u0631 \u062f\u0627\u0634\u062a\u0647 \u0628\u0627\u0634\u06cc\u062f.<br \/>\n\u06a9\u062f \u0628\u0627\u06cc\u062f \u062e\u0648\u062f\u0634 \u062a\u0648\u0636\u06cc\u062d \u062f\u0647\u062f.<\/p>\n<p>\u062a\u0648\u062c\u0647 \u062f\u0627\u0634\u062a\u0647 \u0628\u0627\u0634\u06cc\u062f: \u0645\u0646 \u0627\u0632 *NodeJs *\u0628\u0631\u0627\u06cc \u0627\u06cc\u0646 \u0645\u062b\u0627\u0644 \u0647\u0627 \u0628\u0647 \u062f\u0644\u06cc\u0644 \u0627\u0645\u06a9\u0627\u0646\u0627\u062a \u0627\u0633\u062a\u0641\u0627\u062f\u0647 \u062e\u0648\u0627\u0647\u0645 \u06a9\u0631\u062f\u060c \u0627\u06af\u0631\u0686\u0647 \u0627\u06cc\u0646 \u0627\u06cc\u062f\u0647 \u0647\u0627 \u0628\u0627\u06cc\u062f \u0628\u0647 \u0631\u0627\u062d\u062a\u06cc \u0628\u0627 \u0627\u0633\u062a\u0641\u0627\u062f\u0647 \u0627\u0632 \u0647\u0631 \u0632\u0628\u0627\u0646 \u0628\u0631\u0646\u0627\u0645\u0647 \u0646\u0648\u06cc\u0633\u06cc \u062f\u06cc\u06af\u0631\u06cc \u06a9\u0647 \u0628\u0647 \u0645\u0627 \u0627\u0645\u06a9\u0627\u0646 \u0627\u0633\u062a\u0641\u0627\u062f\u0647 \u0627\u0632 \u067e\u0627\u0631\u0627\u062f\u0627\u06cc\u0645 \u0647\u0627\u06cc OOP \u0648 FP \u0631\u0627 \u0645\u06cc \u062f\u0647\u062f\u060c \u067e\u06cc\u0627\u062f\u0647 \u0633\u0627\u0632\u06cc \u0634\u0648\u0646\u062f.<\/p>\n<p>Complex if then else \u0648 \u0633\u0648\u0626\u06cc\u0686 \u0645\u0648\u0627\u0631\u062f<\/p>\n<p>\u0686\u0646\u062f\u06cc\u0646 \u0628\u0627\u0631 \u06a9\u062f\u06cc \u0628\u0627 \u0634\u0631\u0627\u06cc\u0637 \u062a\u0648 \u062f\u0631 \u062a\u0648 \u06cc\u0627 \u0645\u0648\u0627\u0631\u062f \u0633\u0648\u0626\u06cc\u0686 \u0645\u06cc \u0628\u06cc\u0646\u0645 \u06a9\u0647 \u062f\u0631\u06a9 \u0648 \u062d\u0641\u0638 \u0645\u0646\u0637\u0642 \u0631\u0627 \u0633\u062e\u062a \u0645\u06cc \u06a9\u0646\u062f<\/p>\n<p>const reactByAction = action =&gt; {<br \/>\n  switch (action.type) {<br \/>\n    case &#8216;A&#8217;:<br \/>\n      return calculateA(action)<br \/>\n    case &#8216;B&#8217;:<br \/>\n      return calculateB(action)<br \/>\n    case &#8216;C&#8217;:<br \/>\n      return calculateC(action)<br \/>\n    default:<br \/>\n      return \/\/ Do nothing<br \/>\n  }<br \/>\n}<\/p>\n<p>    \u0648\u0627\u0631\u062f \u062d\u0627\u0644\u062a \u062a\u0645\u0627\u0645 \u0635\u0641\u062d\u0647 \u0634\u0648\u06cc\u062f<\/p>\n<p>    \u0627\u0632 \u062d\u0627\u0644\u062a \u062a\u0645\u0627\u0645 \u0635\u0641\u062d\u0647 \u062e\u0627\u0631\u062c \u0634\u0648\u06cc\u062f<\/p>\n<p>\u062f\u0631 \u0627\u06cc\u0646\u062c\u0627 \u0645\u06cc \u062a\u0648\u0627\u0646\u06cc\u0645 \u0628\u06cc\u0646 \u062f\u0648 \u0631\u0648\u06cc\u06a9\u0631\u062f \u06cc\u06a9\u06cc \u0631\u0627 \u0627\u0646\u062a\u062e\u0627\u0628 \u06a9\u0646\u06cc\u0645.  \u0645\u0627 \u0645\u06cc\u200c\u062a\u0648\u0627\u0646\u06cc\u0645 \u062a\u0635\u0645\u06cc\u0645 \u0628\u06af\u06cc\u0631\u06cc\u0645 \u0627\u0632 *Polymorphism *\u06a9\u0644\u0627\u0633\u06cc\u06a9 \u062f\u0631 OOP \u0627\u0633\u062a\u0641\u0627\u062f\u0647 \u06a9\u0646\u06cc\u0645 \u0648 \u0645\u0633\u0626\u0648\u0644\u06cc\u062a \u0622\u0646 \u0645\u062d\u0627\u0633\u0628\u0627\u062a \u0631\u0627 \u0628\u0647 \u0647\u0631 \u0646\u0645\u0627\u06cc\u0634 \u0639\u0645\u0644\u06cc \u0645\u062d\u0648\u0644 \u06a9\u0646\u06cc\u0645.<\/p>\n<p>const reactByAction = action =&gt; action.calculate()<\/p>\n<p>    \u0648\u0627\u0631\u062f \u062d\u0627\u0644\u062a \u062a\u0645\u0627\u0645 \u0635\u0641\u062d\u0647 \u0634\u0648\u06cc\u062f<\/p>\n<p>    \u0627\u0632 \u062d\u0627\u0644\u062a \u062a\u0645\u0627\u0645 \u0635\u0641\u062d\u0647 \u062e\u0627\u0631\u062c \u0634\u0648\u06cc\u062f<\/p>\n<p>\u062c\u0627\u06cc\u06cc \u06a9\u0647 \u0647\u0631 \u0639\u0645\u0644 \u0645\u06cc \u062f\u0627\u0646\u062f \u0686\u06af\u0648\u0646\u0647 \u0628\u0627\u06cc\u062f \u0645\u062d\u0627\u0633\u0628\u0647 \u0634\u0648\u062f<\/p>\n<p>` \u0627\u06a9\u0634\u0646 \u06a9\u0644\u0627\u0633 \u0627\u0646\u062a\u0632\u0627\u0639\u06cc {\u0645\u062d\u0627\u0633\u0628\u0647 \u0627\u0646\u062a\u0632\u0627\u0639\u06cc()}<\/p>\n<p>class ActionA extends Action {<br \/>\n    calculate() {<br \/>\n        &#8230;<br \/>\n    }<br \/>\n}<\/p>\n<p>class ActionB extends Action {<br \/>\n    calculate() {<br \/>\n        &#8230;<br \/>\n    }<br \/>\n}<\/p>\n<p>&#8230;`<\/p>\n<p>    \u0648\u0627\u0631\u062f \u062d\u0627\u0644\u062a \u062a\u0645\u0627\u0645 \u0635\u0641\u062d\u0647 \u0634\u0648\u06cc\u062f<\/p>\n<p>    \u0627\u0632 \u062d\u0627\u0644\u062a \u062a\u0645\u0627\u0645 \u0635\u0641\u062d\u0647 \u062e\u0627\u0631\u062c \u0634\u0648\u06cc\u062f<\/p>\n<p>\u0627\u0645\u0627\u060c \u062f\u0631 \u0648\u0627\u0642\u0639\u060c \u06af\u0627\u0647\u06cc \u0627\u0648\u0642\u0627\u062a \u062a\u0635\u0648\u0631 \u0645\u06cc\u200c\u0634\u062f \u06a9\u0647 \u0631\u0627\u0647\u200c\u062d\u0644\u200c\u0647\u0627\u06cc \u0645\u0627 \u0645\u0627\u0646\u0646\u062f \u0627\u0634\u06cc\u0627\u0621 \u0646\u0645\u0648\u0646\u0647 \u0631\u0641\u062a\u0627\u0631 \u0646\u0645\u06cc\u200c\u0634\u0648\u0646\u062f.  \u062f\u0631 \u0627\u06cc\u0646 \u062d\u0627\u0644\u062a \u0645\u06cc \u062a\u0648\u0627\u0646\u06cc\u0645 \u0627\u0632 \u0646\u06af\u0627\u0634\u062a \u0634\u06cc\u0621 \u06a9\u0644\u0627\u0633\u06cc\u06a9 \u0648 \u0634\u0641\u0627\u0641\u06cc\u062a \u0627\u0631\u062c\u0627\u0639\u06cc\u060c \u06a9\u0647 \u0645\u0627\u0646\u0646\u062f \u06cc\u06a9 \u0633\u0648\u0626\u06cc\u0686 \u063a\u06cc\u0631 \u0645\u0633\u062a\u0642\u06cc\u0645 \u06a9\u0627\u0631 \u0645\u06cc \u06a9\u0646\u062f\u060c \u0627\u0645\u0627 \u0628\u0647 \u0645\u0627 \u0627\u062c\u0627\u0632\u0647 \u0645\u06cc \u062f\u0647\u062f \u062a\u0627 \u0645\u0648\u0627\u0631\u062f \u067e\u06cc\u0686\u06cc\u062f\u0647 \u0631\u0627 \u062d\u0630\u0641 \u06a9\u0646\u06cc\u0645<\/p>\n<p>const calculateAction = {A: action =&gt; &#8230;,B: action =&gt; &#8230;,C: action =&gt; &#8230;,}<\/p>\n<p>const reactByAction = action =&gt; calculateAction?.[action.type](action)<\/p>\n<p>    \u0648\u0627\u0631\u062f \u062d\u0627\u0644\u062a \u062a\u0645\u0627\u0645 \u0635\u0641\u062d\u0647 \u0634\u0648\u06cc\u062f<\/p>\n<p>    \u0627\u0632 \u062d\u0627\u0644\u062a \u062a\u0645\u0627\u0645 \u0635\u0641\u062d\u0647 \u062e\u0627\u0631\u062c \u0634\u0648\u06cc\u062f<\/p>\n<p>\u0627\u0644\u0628\u062a\u0647\u060c \u0627\u06cc\u0646 \u06cc\u06a9 \u0645\u062d\u062f\u0648\u062f\u06cc\u062a \u062f\u0627\u0631\u062f\u060c \u0647\u0631 \u0628\u0627\u0631 \u06a9\u0647 \u0634\u0645\u0627 \u0646\u06cc\u0627\u0632 \u0628\u0647 &#8220;\u0634\u0646\u0627\u0633\u0627\u06cc\u06cc&#8221; \u06cc\u06a9 \u0646\u0648\u0639 \u0639\u0645\u0644 \u062f\u0627\u0631\u06cc\u062f\u060c \u0628\u0627\u06cc\u062f \u06cc\u06a9 \u0646\u06af\u0627\u0634\u062a \u0634\u06cc \u062b\u0627\u0628\u062a \u062c\u062f\u06cc\u062f \u0627\u06cc\u062c\u0627\u062f \u06a9\u0646\u06cc\u062f.<\/p>\n<p>\u0647\u0631 \u0631\u0627\u0647 \u062d\u0644\u06cc \u06a9\u0647 \u0627\u0646\u062a\u062e\u0627\u0628 \u0645\u06cc\u200c\u0634\u0648\u062f\u060c \u0647\u0645\u06cc\u0634\u0647 \u0645\u06cc\u200c\u062e\u0648\u0627\u0647\u06cc\u062f \u0622\u0646 \u0631\u0627 \u0633\u0627\u062f\u0647 \u0646\u06af\u0647 \u062f\u0627\u0631\u06cc\u062f\u060c \u0645\u0633\u0626\u0648\u0644\u06cc\u062a\u200c\u0647\u0627 \u0631\u0627 \u0628\u0647 \u0628\u0647\u062a\u0631\u06cc\u0646 \u0634\u06a9\u0644 \u0645\u0645\u06a9\u0646 \u0645\u062d\u0648\u0644 \u06a9\u0646\u06cc\u062f\u060c \u062a\u0639\u062f\u0627\u062f \u062e\u0637\u0648\u0637 \u0631\u0627\u0647\u200c\u062d\u0644 \u062e\u0648\u062f \u0631\u0627 \u062a\u0648\u0632\u06cc\u0639 \u06a9\u0646\u06cc\u062f \u0648 \u0627\u0632 \u06cc\u06a9 \u0646\u0627\u0645 \u062a\u0648\u0636\u06cc\u062d\u06cc \u062e\u0648\u0628 \u0628\u0631\u0627\u06cc \u0633\u0627\u062f\u0647\u200c\u0633\u0627\u0632\u06cc \u062f\u0631\u06a9\/\u0645\u0642\u06cc\u0627\u0633\u200c\u067e\u0630\u06cc\u0631\u06cc \u0627\u0633\u062a\u0641\u0627\u062f\u0647 \u06a9\u0646\u06cc\u062f.<\/p>\n<p>\u0627\u06af\u0631 \u0646\u0645\u06cc \u062a\u0648\u0627\u0646\u06cc\u062f \u06cc\u06a9 \u0646\u0645\u0648\u0646\u0647 \u0627\u0632 \u0647\u0631 \u0639\u0645\u0644 \u0627\u0631\u0627\u0626\u0647 \u062f\u0647\u06cc\u062f\u060c \u067e\u06cc\u0634\u0646\u0647\u0627\u062f \u0645\u06cc \u06a9\u0646\u0645 \u067e\u06cc\u0627\u062f\u0647 \u0633\u0627\u0632\u06cc \u0630\u0648\u0628 \u0634\u062f\u0647 \u0631\u0627 \u0627\u062c\u0631\u0627 \u06a9\u0646\u06cc\u062f<\/p>\n<p>` \u06a9\u0644\u0627\u0633 Handler {\u0633\u0627\u0632\u0646\u062f\u0647() {this.actionMap = {A: action => new ActionA(action)\u060cB: action => new ActionB(action)C: action => new ActionC(action)};}<\/p>\n<p>  reactByAction = action =&gt; this.actionMap[action.type]?.(action).calculate()<br \/>\n}`<\/p>\n<p>    \u0648\u0627\u0631\u062f \u062d\u0627\u0644\u062a \u062a\u0645\u0627\u0645 \u0635\u0641\u062d\u0647 \u0634\u0648\u06cc\u062f<\/p>\n<p>    \u0627\u0632 \u062d\u0627\u0644\u062a \u062a\u0645\u0627\u0645 \u0635\u0641\u062d\u0647 \u062e\u0627\u0631\u062c \u0634\u0648\u06cc\u062f<\/p>\n<p>\u062a\u0639\u0627\u0631\u06cc\u0641 \u067e\u0627\u0631\u0627\u0645\u062a\u0631\u0647\u0627\u06cc \u063a\u06cc\u0631 \u0636\u0631\u0648\u0631\u06cc<\/p>\n<p>\u06af\u0627\u0647\u06cc \u0627\u0648\u0642\u0627\u062a\u060c \u0645\u0627 \u062a\u0648\u0627\u0628\u0639\/\u0631\u0648\u0634 \u0647\u0627\u06cc\u06cc \u0631\u0627 \u0628\u0627 \u067e\u0627\u0631\u0627\u0645\u062a\u0631\u0647\u0627\u06cc \u0632\u06cc\u0627\u062f\u06cc \u06a9\u0647 \u0645\u06cc \u062a\u0648\u0627\u0646\u0646\u062f \u0627\u0632 \u06cc\u06a9 \u0632\u0645\u06cc\u0646\u0647 \u0645\u0634\u062a\u0631\u06a9 \u0645\u0634\u062a\u0642 \u0634\u0648\u0646\u062f\u060c \u067e\u06cc\u0627\u062f\u0647 \u0633\u0627\u0632\u06cc \u0645\u06cc \u06a9\u0646\u06cc\u0645\u060c \u062f\u0631 \u0627\u06cc\u0646\u062c\u0627 \u06cc\u06a9 \u0645\u062b\u0627\u0644 \u0633\u0627\u062f\u0647 \u0648\u062c\u0648\u062f \u062f\u0627\u0631\u062f.`const totalPrice = (\u0642\u06cc\u0645\u062a\u060c \u0646\u0631\u062e \u0645\u0627\u0644\u06cc\u0627\u062a\u060c \u0646\u0631\u062e \u062a\u062e\u0641\u06cc\u0641) => {const taxAmount = \u0642\u06cc\u0645\u062a * \u0646\u0631\u062e \u0645\u0627\u0644\u06cc\u0627\u062aconst discountAmount = \u0642\u06cc\u0645\u062a * \u0646\u0631\u062e \u062a\u062e\u0641\u06cc\u0641\u0642\u06cc\u0645\u062a \u0628\u0627\u0632\u06af\u0634\u062a + \u0645\u0627\u0644\u06cc\u0627\u062a \u0645\u0628\u0644\u063a &#8211; \u062a\u062e\u0641\u06cc\u0641 \u0645\u0628\u0644\u063a}<\/p>\n<p>const totalForRegularCustomer = price =&gt; totalPrice(price, 0.1, 0)<br \/>\nconst totalForPremiumCustomer = price =&gt; totalPrice(price, 0.1, 0.1)`<\/p>\n<p>    \u0648\u0627\u0631\u062f \u062d\u0627\u0644\u062a \u062a\u0645\u0627\u0645 \u0635\u0641\u062d\u0647 \u0634\u0648\u06cc\u062f<\/p>\n<p>    \u0627\u0632 \u062d\u0627\u0644\u062a \u062a\u0645\u0627\u0645 \u0635\u0641\u062d\u0647 \u062e\u0627\u0631\u062c \u0634\u0648\u06cc\u062f<\/p>\n<p>\u062a\u0639\u0627\u0631\u06cc\u0641 \u062f\u0631\u0633\u062a \u0647\u0633\u062a\u0646\u062f\u060c \u0627\u0645\u0627 \u0645\u06cc\u200c\u062a\u0648\u0627\u0646\u06cc\u0645 \u062a\u0639\u062f\u0627\u062f \u0645\u0633\u0626\u0648\u0644\u06cc\u062a\u200c\u0647\u0627 \u0631\u0627 \u0628\u0627 \u062c\u062f\u0627 \u06a9\u0631\u062f\u0646 \u062a\u0627\u0628\u0639\u060c \u0628\u0627 \u0627\u0633\u062a\u0641\u0627\u062f\u0647 \u0627\u0632 \u0645\u0641\u0647\u0648\u0645 Currying \u0648 \u06a9\u0644\u0627\u0633\u200c\u0647\u0627 \u0628\u0631\u0627\u06cc \u0645\u062d\u0635\u0648\u0631 \u06a9\u0631\u062f\u0646 \u062c\u0632\u0626\u06cc\u0627\u062a \u0648 \u0627\u06cc\u062c\u0627\u062f \u0631\u0648\u0634\u200c\u0647\u0627\u06cc \u062a\u062e\u0635\u0635\u06cc\u200c\u062a\u0631 \u0633\u0627\u062f\u0647\u200c\u0633\u0627\u0632\u06cc \u06a9\u0646\u06cc\u0645.<\/p>\n<p>\u062f\u0631 \u0627\u06cc\u0646\u062c\u0627 \u06cc\u06a9 \u067e\u06cc\u0634\u0646\u0647\u0627\u062f \u0633\u0627\u062f\u0647 \u0628\u0627 \u0627\u0633\u062a\u0641\u0627\u062f\u0647 \u0627\u0632 OOP \u0648\u062c\u0648\u062f \u062f\u0627\u0631\u062f<\/p>\n<p>` \u0645\u0634\u062a\u0631\u06cc \u06a9\u0644\u0627\u0633 {taxAmount = \u0642\u06cc\u0645\u062a => \u0642\u06cc\u0645\u062a * this.taxRate()discountAmount = \u0642\u06cc\u0645\u062a => \u0642\u06cc\u0645\u062a * this.discountRate()totalPrice = \u0642\u06cc\u0645\u062a => \u0642\u06cc\u0645\u062a + this.taxAmount(price) &#8211; this.discountAmount(price)}<\/p>\n<p>class RegularCustomer extends Customer {<br \/>\n  taxRate = () =&gt; 0.1<br \/>\n  discountRate = () =&gt; 0<br \/>\n}<\/p>\n<p>class PremiumCustomer extends Customer {<br \/>\n  taxRate = () =&gt; 0.05<br \/>\n  discountRate = () =&gt; 0.1<br \/>\n}`<\/p>\n<p>    \u0648\u0627\u0631\u062f \u062d\u0627\u0644\u062a \u062a\u0645\u0627\u0645 \u0635\u0641\u062d\u0647 \u0634\u0648\u06cc\u062f<\/p>\n<p>    \u0627\u0632 \u062d\u0627\u0644\u062a \u062a\u0645\u0627\u0645 \u0635\u0641\u062d\u0647 \u062e\u0627\u0631\u062c \u0634\u0648\u06cc\u062f<\/p>\n<p>\u062a\u0648\u062c\u0647 \u062f\u0627\u0634\u062a\u0647 \u0628\u0627\u0634\u06cc\u062f \u06a9\u0647 \u0645\u0646 \u0627\u0632 \u0631\u0648\u0634 \u0627\u0644\u06af\u0648\u06cc \u0627\u0644\u06af\u0648 \u0627\u0633\u062a\u0641\u0627\u062f\u0647 \u06a9\u0631\u062f\u0645 \ud83d\ude42<\/p>\n<p>\u0648 \u062f\u0631 \u0627\u06cc\u0646\u062c\u0627 \u06af\u0632\u06cc\u0646\u0647 \u062f\u06cc\u06af\u0631\u06cc \u0628\u0627 \u0627\u0633\u062a\u0641\u0627\u062f\u0647 \u0627\u0632 FP \u0648\u062c\u0648\u062f \u062f\u0627\u0631\u062f<\/p>\n<p>` \u0645\u0627\u0644\u06cc\u0627\u062a \u0628\u0631 \u0647\u0632\u06cc\u0646\u0647 = \u0646\u0631\u062e \u0645\u0627\u0644\u06cc\u0627\u062a => \u0642\u06cc\u0645\u062a => \u0642\u06cc\u0645\u062a * \u0646\u0631\u062e \u0645\u0627\u0644\u06cc\u0627\u062aconst discount = discountRate => price => price * discountRate<\/p>\n<p>const regularTaxAmout = tax(0.1)<br \/>\nconst premiumTaxAmout = tax(0.05)<br \/>\nconst regularDiscount = discount(0)<br \/>\nconst premiumDiscount = discount(0.1)<\/p>\n<p>const calculationWithRates = (taxRateFunc, discountRateFunc) =&gt; price =&gt;<br \/>\n  price + taxRateFunc(price) &#8211; discountRateFunc(price)<\/p>\n<p>const totalForRegularCustomer = calculationWithRates(regularTaxAmout, regularDiscount)<br \/>\nconst totalForPremiumCustomer = calculationWithRates(premiumTaxAmout, premiumDiscount)`<\/p>\n<p>    \u0648\u0627\u0631\u062f \u062d\u0627\u0644\u062a \u062a\u0645\u0627\u0645 \u0635\u0641\u062d\u0647 \u0634\u0648\u06cc\u062f<\/p>\n<p>    \u0627\u0632 \u062d\u0627\u0644\u062a \u062a\u0645\u0627\u0645 \u0635\u0641\u062d\u0647 \u062e\u0627\u0631\u062c \u0634\u0648\u06cc\u062f<\/p>\n<p>\u062a\u0648\u062c\u0647 \u062f\u0627\u0634\u062a\u0647 \u0628\u0627\u0634\u06cc\u062f \u06a9\u0647 \u0645\u0646 \u062a\u0648\u0627\u0628\u0639 \u0631\u0627 \u0628\u0631\u0627\u06cc \u0627\u0631\u0627\u0626\u0647 \u0627\u0646\u062a\u0632\u0627\u0639\u0627\u062a \u0628\u06cc\u0634\u062a\u0631 \u0648 \u0627\u0641\u0632\u0627\u06cc\u0634 \u0642\u0627\u0628\u0644\u06cc\u062a \u0627\u0639\u0644\u0627\u0646 \u0627\u0646\u062c\u0627\u0645 \u0645\u06cc \u062f\u0647\u0645<\/p>\n<p>\u0628\u0627\u0632 \u0647\u0645\u060c \u0645\u0627 \u0645\u06cc \u062a\u0648\u0627\u0646\u06cc\u0645 \u0647\u0631 \u062f\u0648 \u067e\u0627\u0631\u0627\u062f\u0627\u06cc\u0645 \u0631\u0627 \u062f\u0631 \u06cc\u06a9 \u0637\u0631\u062d \u062a\u0631\u06a9\u06cc\u0628\u06cc \u062a\u0631\u06a9\u06cc\u0628 \u06a9\u0646\u06cc\u0645 \ud83d\ude42<\/p>\n<p>` \u0645\u0634\u062a\u0631\u06cc \u06a9\u0644\u0627\u0633 {\u0633\u0627\u0632\u0646\u062f\u0647 (\u0646\u0631\u062e \u0645\u0627\u0644\u06cc\u0627\u062a\u060c \u0646\u0631\u062e \u062a\u062e\u0641\u06cc\u0641) {this.taxRate = taxRatethis.discountRate = discountRate}<\/p>\n<p>  totalPrice = price =&gt; price + this.calculateTax(price) &#8211; this.calculateDiscount(price)<\/p>\n<p>  calculateTax = price =&gt; price * this.taxRate<br \/>\n  calculateDiscount = price =&gt; price * this.discountRate<br \/>\n}<\/p>\n<p>const regularCustomer = new Customer(0.1, 0)<br \/>\nconst premiumCustomer = new Customer(0.05, 0.1)<\/p>\n<p>const total = customer =&gt; customer.totalPrice<\/p>\n<p>const totalForRegularCustomer = total(regularCustomer)<br \/>\nconst totalForPremiumCustomer = total(premiumCustomer)`<\/p>\n<p>    \u0648\u0627\u0631\u062f \u062d\u0627\u0644\u062a \u062a\u0645\u0627\u0645 \u0635\u0641\u062d\u0647 \u0634\u0648\u06cc\u062f<\/p>\n<p>    \u0627\u0632 \u062d\u0627\u0644\u062a \u062a\u0645\u0627\u0645 \u0635\u0641\u062d\u0647 \u062e\u0627\u0631\u062c \u0634\u0648\u06cc\u062f<\/p>\n<p>\u0631\u0648\u0634\/\u0639\u0645\u0644\u06a9\u0631\u062f\u0647\u0627\u06cc \u0637\u0648\u0644\u0627\u0646\u06cc \u0628\u06cc\u0634 \u0627\u0632 \u062d\u062f<\/p>\n<p>\u06a9\u0644\u0627\u0633\u06cc\u06a9 \u062f\u06cc\u06af\u0631\u06cc \u06a9\u0647 \u0645\u0646 \u0628\u0647 \u062f\u06cc\u062f\u0646 \u0622\u0646 \u0639\u0627\u062f\u062a \u062f\u0627\u0631\u0645 \u0631\u0648\u0634 \u0647\u0627 \u0648 \u0639\u0645\u0644\u06a9\u0631\u062f\u0647\u0627\u06cc\u06cc \u0628\u0627 \u0645\u0633\u0626\u0648\u0644\u06cc\u062a \u0647\u0627\u06cc \u0632\u06cc\u0627\u062f\u060c \u0628\u06cc\u0634 \u0627\u0632 \u062d\u062f \u0637\u0648\u0644\u0627\u0646\u06cc\u060c \u0628\u0627 \u0642\u0631\u0627\u0631\u062f\u0627\u062f\u0647\u0627\u06cc \u0633\u062e\u062a \u06a9\u062f\u06af\u0630\u0627\u0631\u06cc \u0634\u062f\u0647 \u0648 \u0642\u0648\u0627\u0646\u06cc\u0646 \u062a\u062c\u0627\u0631\u06cc \u067e\u06cc\u0686\u06cc\u062f\u0647 \u0627\u0633\u062a.<\/p>\n<p>` const tokenize = \u06a9\u062f => {let tokens = []\u0627\u062c\u0627\u0632\u0647 \u062f\u0647\u06cc\u062f currentToken = &#8221;\u0628\u06af\u0630\u0627\u0631\u06cc\u062f currentType = null<\/p>\n<p>    for (let i = 0; i &lt; code.length; i++) {<br \/>\n        let char = code[i]\n<p>        if (char === &#8216; &#8216; || char === &#8216;<\/p>\n<p>    \u0648\u0627\u0631\u062f \u062d\u0627\u0644\u062a \u062a\u0645\u0627\u0645 \u0635\u0641\u062d\u0647 \u0634\u0648\u06cc\u062f<\/p>\n<p>    \u0627\u0632 \u062d\u0627\u0644\u062a \u062a\u0645\u0627\u0645 \u0635\u0641\u062d\u0647 \u062e\u0627\u0631\u062c \u0634\u0648\u06cc\u062f<\/p>\n<p>&#8216; ||  \u06a9\u0627\u0631\u0627\u06a9\u062a\u0631 === &#8221;) {if (currentToken !== &#8221;) {tokens.push({ type: currentType\u060c \u0645\u0642\u062f\u0627\u0631: currentToken })CurrentToken = &#8221;CurrentType = null}} else if (char === &#8216;+&#8217; || char === &#8216;-&#8216; || char === &#8216;*&#8217; || char === &#8220;https:\/\/dev.to\/&#8221;) {if (currentToken !== &#8221;) {tokens.push({ type: currentType\u060c \u0645\u0642\u062f\u0627\u0631: currentToken })currentToken = &#8221;}tokens.push({ type: &#8216;operator&#8217;, value: char });} else if (char >= &#8216;0&#8217; &#038;&#038; char = &#8216;a&#8217; &#038;&#038; char = &#8216;A&#8217; &#038;&#038; char <\/p>\n<div data-article-id=\"1901971\" id=\"article-body\">\n<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_85 counter-hierarchy ez-toc-counter-rtl ez-toc-grey ez-toc-container-direction\">\n<div class=\"ez-toc-title-container\">\n<p class=\"ez-toc-title\" style=\"cursor:inherit\">\u0641\u0647\u0631\u0633\u062a \u0645\u0637\u0627\u0644\u0628<\/p>\n<span class=\"ez-toc-title-toggle\"><a href=\"#\" class=\"ez-toc-pull-right ez-toc-btn ez-toc-btn-xs ez-toc-btn-default ez-toc-toggle\" aria-label=\"Toggle Table of Content\"><span class=\"ez-toc-js-icon-con\"><span class=\"\"><span class=\"eztoc-hide\" style=\"display:none;\">Toggle<\/span><span class=\"ez-toc-icon-toggle-span\"><svg style=\"fill: #999;color:#999\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" class=\"list-377408\" width=\"20px\" height=\"20px\" viewBox=\"0 0 24 24\" fill=\"none\"><path d=\"M6 6H4v2h2V6zm14 0H8v2h12V6zM4 11h2v2H4v-2zm16 0H8v2h12v-2zM4 16h2v2H4v-2zm16 0H8v2h12v-2z\" fill=\"currentColor\"><\/path><\/svg><svg style=\"fill: #999;color:#999\" class=\"arrow-unsorted-368013\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"10px\" height=\"10px\" viewBox=\"0 0 24 24\" version=\"1.2\" baseProfile=\"tiny\"><path d=\"M18.2 9.3l-6.2-6.3-6.2 6.3c-.2.2-.3.4-.3.7s.1.5.3.7c.2.2.4.3.7.3h11c.3 0 .5-.1.7-.3.2-.2.3-.5.3-.7s-.1-.5-.3-.7zM5.8 14.7l6.2 6.3 6.2-6.3c.2-.2.3-.5.3-.7s-.1-.5-.3-.7c-.2-.2-.4-.3-.7-.3h-11c-.3 0-.5.1-.7.3-.2.2-.3.5-.3.7s.1.5.3.7z\"\/><\/svg><\/span><\/span><\/span><\/a><\/span><\/div>\n<nav><ul class='ez-toc-list ez-toc-list-level-1 ' ><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/nabfollower.com\/blog\/software-design-using-oop-fp-part-1-2fgh\/#%D8%B7%D8%B1%D8%A7%D8%AD%DB%8C_%D9%86%D8%B1%D9%85_%D8%A7%D9%81%D8%B2%D8%A7%D8%B1_%D8%A8%D8%A7_%D8%A7%D8%B3%D8%AA%D9%81%D8%A7%D8%AF%D9%87_%D8%A7%D8%B2_OOP_FP_%E2%80%93_%D9%82%D8%B3%D9%85%D8%AA_1\" >\u0637\u0631\u0627\u062d\u06cc \u0646\u0631\u0645 \u0627\u0641\u0632\u0627\u0631 \u0628\u0627 \u0627\u0633\u062a\u0641\u0627\u062f\u0647 \u0627\u0632 OOP + FP &#8211; \u0642\u0633\u0645\u062a 1<\/a><ul class='ez-toc-list-level-3' ><li class='ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/nabfollower.com\/blog\/software-design-using-oop-fp-part-1-2fgh\/#%D9%88%DB%8C%DA%98%DA%AF%DB%8C_%D9%87%D8%A7%DB%8C_%D8%A8%D8%B1%D9%86%D8%A7%D9%85%D9%87_%D9%86%D9%88%DB%8C%D8%B3%DB%8C_%D8%B4%DB%8C_%DA%AF%D8%B1%D8%A7\" >\u0648\u06cc\u0698\u06af\u06cc \u0647\u0627\u06cc \u0628\u0631\u0646\u0627\u0645\u0647 \u0646\u0648\u06cc\u0633\u06cc \u0634\u06cc \u06af\u0631\u0627<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/nabfollower.com\/blog\/software-design-using-oop-fp-part-1-2fgh\/#%D9%88%DB%8C%DA%98%DA%AF%DB%8C_%D9%87%D8%A7%DB%8C_%D8%A8%D8%B1%D9%86%D8%A7%D9%85%D9%87_%D9%86%D9%88%DB%8C%D8%B3%DB%8C_%DA%A9%D8%A7%D8%B1%D8%A8%D8%B1%D8%AF%DB%8C\" >\u0648\u06cc\u0698\u06af\u06cc \u0647\u0627\u06cc \u0628\u0631\u0646\u0627\u0645\u0647 \u0646\u0648\u06cc\u0633\u06cc \u06a9\u0627\u0631\u0628\u0631\u062f\u06cc<\/a><\/li><\/ul><\/li><\/ul><\/nav><\/div>\n<h2><span class=\"ez-toc-section\" id=\"%D8%B7%D8%B1%D8%A7%D8%AD%DB%8C_%D9%86%D8%B1%D9%85_%D8%A7%D9%81%D8%B2%D8%A7%D8%B1_%D8%A8%D8%A7_%D8%A7%D8%B3%D8%AA%D9%81%D8%A7%D8%AF%D9%87_%D8%A7%D8%B2_OOP_FP_%E2%80%93_%D9%82%D8%B3%D9%85%D8%AA_1\"><\/span>\n<p>  \u0637\u0631\u0627\u062d\u06cc \u0646\u0631\u0645 \u0627\u0641\u0632\u0627\u0631 \u0628\u0627 \u0627\u0633\u062a\u0641\u0627\u062f\u0647 \u0627\u0632 OOP + FP &#8211; \u0642\u0633\u0645\u062a 1<br \/>\n<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>\u0628\u06cc\u0627\u06cc\u06cc\u062f \u0631\u0627\u0647 \u062d\u0644 \u0647\u0627\u06cc \u062f\u06cc\u0648\u0627\u0646\u0647 \u06a9\u0646\u0646\u062f\u0647 \u0627\u06cc \u0631\u0627 \u0628\u0627 \u062a\u0631\u06a9\u06cc\u0628 OOP \u0648 FP \u0627\u0646\u062c\u0627\u0645 \u062f\u0647\u06cc\u0645 \ud83d\ude42<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/res.cloudinary.com\/practicaldev\/image\/fetch\/s--jucLfNFO--\/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800\/https:\/\/cdn-images-1.medium.com\/max\/5478\/1%2AxFZOawpc9h81Voxftmc1Pg.jpeg\" loading=\"lazy\" width=\"800\" height=\"454\" alt=\"\" title=\"\"><\/p>\n<p>\u0627\u06cc\u062f\u0647 \u0627\u06cc\u0646 \u0645\u0642\u0627\u0644\u0647 \u0627\u06cc\u0646 \u0627\u0633\u062a \u06a9\u0647 \u0686\u0646\u062f\u06cc\u0646 \u0627\u0644\u06af\u0648 \u0631\u0627 \u062e\u0644\u0627\u0635\u0647 \u06a9\u0646\u062f \u0648 \u0645\u062b\u0627\u0644 \u0647\u0627\u06cc\u06cc \u0627\u0632 \u0646\u062d\u0648\u0647 \u062d\u0644 \u0645\u0648\u0627\u0631\u062f \u062e\u0627\u0635 \u0628\u0627 \u0627\u0633\u062a\u0641\u0627\u062f\u0647 \u0627\u0632 \u0628\u0631\u0646\u0627\u0645\u0647 \u0646\u0648\u06cc\u0633\u06cc \u0634\u06cc \u06af\u0631\u0627 \u0627\u0631\u0627\u0626\u0647 \u062f\u0647\u062f.<strong>OOP<\/strong>) \u0648 \u0628\u0631\u0646\u0627\u0645\u0647 \u0646\u0648\u06cc\u0633\u06cc \u062a\u0627\u0628\u0639\u06cc (<strong>FP<\/strong>) \u0628\u0631\u0627\u06cc \u0628\u0647 \u062f\u0633\u062a \u0622\u0648\u0631\u062f\u0646 \u0631\u0627\u0647 \u062d\u0644 \u0647\u0627\u06cc \u0628\u0647\u062a\u0631.<\/p>\n<p>\u062f\u0631 \u0637\u0648\u0644 \u0632\u0646\u062f\u06af\u06cc \u062d\u0631\u0641\u0647 \u0627\u06cc \u062e\u0648\u062f\u060c \u0645\u06cc \u062a\u0648\u0627\u0646\u06cc\u0645 \u0628\u06cc\u0646 \u067e\u0627\u0631\u0627\u062f\u0627\u06cc\u0645 \u0647\u0627\u06cc \u0628\u0631\u0646\u0627\u0645\u0647 \u0646\u0648\u06cc\u0633\u06cc \u0645\u062e\u062a\u0644\u0641 \u062d\u0631\u06a9\u062a \u06a9\u0646\u06cc\u0645.  \u0647\u0631 \u06a9\u062f\u0627\u0645 \u0646\u0642\u0627\u0637 \u0642\u0648\u062a \u0648 \u0636\u0639\u0641 \u062e\u0648\u062f \u0631\u0627 \u062f\u0627\u0631\u0646\u062f \u0648 \u0628\u06cc\u0634 \u0627\u0632 \u062f\u0648 \u0645\u0648\u0631\u062f \u0648\u062c\u0648\u062f \u062f\u0627\u0631\u062f.  \u0645\u0627 OOP \u0648 FP \u0631\u0627 \u0628\u0631\u0631\u0633\u06cc \u062e\u0648\u0627\u0647\u06cc\u0645 \u06a9\u0631\u062f \u0632\u06cc\u0631\u0627 \u0622\u0646\u0647\u0627 \u0628\u06cc\u0634\u062a\u0631\u06cc\u0646 \u0627\u0633\u062a\u0641\u0627\u062f\u0647 \u0631\u0627 \u062f\u0627\u0631\u0646\u062f.  \u0646\u06a9\u062a\u0647 \u06a9\u0644\u06cc\u062f\u06cc \u0647\u0645\u06cc\u0634\u0647 \u0627\u06cc\u0646 \u0627\u0633\u062a \u06a9\u0647 \u0628\u062f\u0627\u0646\u06cc\u062f \u0686\u0647 \u0632\u0645\u0627\u0646\u06cc \u0648 \u0686\u06af\u0648\u0646\u0647 \u0647\u0631 \u06a9\u062f\u0627\u0645 \u0631\u0627 \u0628\u0631\u0627\u06cc \u0628\u0647 \u062f\u0633\u062a \u0622\u0648\u0631\u062f\u0646 \u0631\u0627\u0647 \u062d\u0644 \u0647\u0627\u06cc \u0628\u0647\u062a\u0631 \u0627\u0639\u0645\u0627\u0644 \u06a9\u0646\u06cc\u062f.<\/p>\n<p>\u0628\u06cc\u0627\u06cc\u06cc\u062f \u06cc\u06a9 \u0628\u0631\u0631\u0633\u06cc \u0633\u0631\u06cc\u0639 \u0627\u0632 \u0627\u06cc\u062f\u0647 \u0647\u0627\/\u0645\u0641\u0627\u0647\u06cc\u0645 \u0627\u0635\u0644\u06cc \u0647\u0631 \u067e\u0627\u0631\u0627\u062f\u0627\u06cc\u0645 \u062f\u0627\u0634\u062a\u0647 \u0628\u0627\u0634\u06cc\u0645<\/p>\n<h3><span class=\"ez-toc-section\" id=\"%D9%88%DB%8C%DA%98%DA%AF%DB%8C_%D9%87%D8%A7%DB%8C_%D8%A8%D8%B1%D9%86%D8%A7%D9%85%D9%87_%D9%86%D9%88%DB%8C%D8%B3%DB%8C_%D8%B4%DB%8C_%DA%AF%D8%B1%D8%A7\"><\/span>\n<p>  \u0648\u06cc\u0698\u06af\u06cc \u0647\u0627\u06cc \u0628\u0631\u0646\u0627\u0645\u0647 \u0646\u0648\u06cc\u0633\u06cc \u0634\u06cc \u06af\u0631\u0627<br \/>\n<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<ul>\n<li>\n<p><em>\u06a9\u067e\u0633\u0648\u0644\u0647 \u0633\u0627\u0632\u06cc<\/em>: \u067e\u0646\u0647\u0627\u0646 \u06a9\u0631\u062f\u0646 \u062c\u0632\u0626\u06cc\u0627\u062a \u062f\u0627\u062e\u0644\u06cc \u0648 \u0627\u0641\u0634\u0627\u06cc \u062a\u0646\u0647\u0627 \u0645\u0648\u0627\u0631\u062f \u0636\u0631\u0648\u0631\u06cc.<\/p>\n<\/li>\n<li>\n<p><em>\u0648\u0631\u0627\u062b\u062a<\/em>: \u0627\u06cc\u062c\u0627\u062f \u06a9\u0644\u0627\u0633 \u0647\u0627\u06cc \u062c\u062f\u06cc\u062f \u0628\u0631 \u0627\u0633\u0627\u0633 \u06a9\u0644\u0627\u0633 \u0647\u0627\u06cc \u0645\u0648\u062c\u0648\u062f.<\/p>\n<\/li>\n<li>\n<p><em>\u067e\u0644\u06cc \u0645\u0648\u0631\u0641\u06cc\u0633\u0645<\/em>: \u06a9\u0644\u0627\u0633 \u0647\u0627\u06cc \u0645\u062e\u062a\u0644\u0641 \u0631\u0627 \u0645\u06cc \u062a\u0648\u0627\u0646 \u0627\u0632 \u0637\u0631\u06cc\u0642 \u06cc\u06a9 \u0631\u0627\u0628\u0637 \u0645\u0634\u062a\u0631\u06a9 \u062f\u0631\u0645\u0627\u0646 \u06a9\u0631\u062f.<\/p>\n<\/li>\n<li>\n<p><em>\u0627\u0646\u062a\u0632\u0627\u0639 &#8211; \u0645\u0641\u0647\u0648\u0645 &#8211; \u0628\u0631\u062f\u0627\u0634\u062a<\/em>: \u0633\u0627\u062f\u0647 \u0633\u0627\u0632\u06cc \u0633\u06cc\u0633\u062a\u0645 \u0647\u0627\u06cc \u067e\u06cc\u0686\u06cc\u062f\u0647 \u0628\u0627 \u067e\u0646\u0647\u0627\u0646 \u06a9\u0631\u062f\u0646 \u062c\u0632\u0626\u06cc\u0627\u062a \u063a\u06cc\u0631 \u0636\u0631\u0648\u0631\u06cc.<\/p>\n<\/li>\n<li>\n<p><em>\u0635\u062d\u0627\u0641\u06cc \u067e\u0648\u06cc\u0627<\/em>: \u062a\u0639\u06cc\u06cc\u0646 \u0627\u06cc\u0646\u06a9\u0647 \u06a9\u062f\u0627\u0645 \u0645\u062a\u062f \u062f\u0631 \u0632\u0645\u0627\u0646 \u0627\u062c\u0631\u0627 \u0628\u0647 \u062c\u0627\u06cc \u0632\u0645\u0627\u0646 \u06a9\u0627\u0645\u067e\u0627\u06cc\u0644 \u0641\u0631\u0627\u062e\u0648\u0627\u0646\u06cc \u0634\u0648\u062f.<\/p>\n<\/li>\n<li>\n<p><em>\u0627\u0631\u0633\u0627\u0644 \u067e\u06cc\u0627\u0645<\/em>: \u0627\u0634\u06cc\u0627 \u0628\u0627 \u0627\u0631\u0633\u0627\u0644 \u0648 \u062f\u0631\u06cc\u0627\u0641\u062a \u067e\u06cc\u0627\u0645 \u0628\u0627 \u06cc\u06a9\u062f\u06cc\u06af\u0631 \u0627\u0631\u062a\u0628\u0627\u0637 \u0628\u0631\u0642\u0631\u0627\u0631 \u0645\u06cc \u06a9\u0646\u0646\u062f.<\/p>\n<\/li>\n<\/ul>\n<h3><span class=\"ez-toc-section\" id=\"%D9%88%DB%8C%DA%98%DA%AF%DB%8C_%D9%87%D8%A7%DB%8C_%D8%A8%D8%B1%D9%86%D8%A7%D9%85%D9%87_%D9%86%D9%88%DB%8C%D8%B3%DB%8C_%DA%A9%D8%A7%D8%B1%D8%A8%D8%B1%D8%AF%DB%8C\"><\/span>\n<p>  \u0648\u06cc\u0698\u06af\u06cc \u0647\u0627\u06cc \u0628\u0631\u0646\u0627\u0645\u0647 \u0646\u0648\u06cc\u0633\u06cc \u06a9\u0627\u0631\u0628\u0631\u062f\u06cc<br \/>\n<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<ul>\n<li>\n<p><em>\u062a\u063a\u06cc\u06cc\u0631\u0646\u0627\u067e\u0630\u06cc\u0631\u06cc<\/em>: \u062f\u0627\u062f\u0647 \u0647\u0627 \u067e\u0633 \u0627\u0632 \u0627\u06cc\u062c\u0627\u062f \u062a\u063a\u06cc\u06cc\u0631 \u0646\u0645\u06cc \u06a9\u0646\u0646\u062f.<\/p>\n<\/li>\n<li>\n<p><em>\u062a\u0648\u0627\u0628\u0639 \u062e\u0627\u0644\u0635<\/em>: \u0647\u0645\u06cc\u0634\u0647 \u06cc\u06a9 \u0646\u062a\u06cc\u062c\u0647 \u0631\u0627 \u0628\u0631\u0627\u06cc \u0648\u0631\u0648\u062f\u06cc \u0647\u0627\u06cc \u06cc\u06a9\u0633\u0627\u0646 \u0628\u0631\u06af\u0631\u062f\u0627\u0646\u06cc\u062f.<\/p>\n<\/li>\n<li>\n<p><em>\u062a\u0631\u06a9\u06cc\u0628 \u062a\u0627\u0628\u0639<\/em>: \u062a\u0631\u06a9\u06cc\u0628 \u062a\u0648\u0627\u0628\u0639 \u0633\u0627\u062f\u0647 \u0628\u0631\u0627\u06cc \u0627\u06cc\u062c\u0627\u062f \u062a\u0648\u0627\u0628\u0639 \u067e\u06cc\u0686\u06cc\u062f\u0647 \u062a\u0631.<\/p>\n<\/li>\n<li>\n<p><em>\u0628\u0627\u0632\u06af\u0634\u062a<\/em>: \u062d\u0644 \u0645\u0633\u0627\u0626\u0644 \u0628\u0627 \u062a\u0642\u0633\u06cc\u0645 \u06a9\u0631\u062f\u0646 \u0622\u0646\u0647\u0627 \u0628\u0647 \u0645\u0648\u0627\u0631\u062f \u06a9\u0648\u0686\u06a9\u062a\u0631 \u0647\u0645\u0627\u0646 \u0645\u0634\u06a9\u0644.<\/p>\n<\/li>\n<li>\n<p><em>\u0646\u0638\u0645 \u0628\u0627\u0644\u0627<\/em>: \u062a\u0648\u0627\u0628\u0639\u06cc \u06a9\u0647 \u062a\u0648\u0627\u0628\u0639 \u062f\u06cc\u06af\u0631 \u0631\u0627 \u0628\u0647 \u0639\u0646\u0648\u0627\u0646 \u0622\u0631\u06af\u0648\u0645\u0627\u0646 \u0645\u06cc \u06af\u06cc\u0631\u0646\u062f \u06cc\u0627 \u062a\u0648\u0627\u0628\u0639 \u0631\u0627 \u0628\u0647 \u0639\u0646\u0648\u0627\u0646 \u0646\u062a\u06cc\u062c\u0647 \u0628\u0631\u0645\u06cc \u06af\u0631\u062f\u0646\u062f.<\/p>\n<\/li>\n<li>\n<p><em>\u0634\u0641\u0627\u0641\u06cc\u062a \u0627\u0631\u062c\u0627\u0639\u06cc<\/em>: \u06cc\u06a9 \u0639\u0628\u0627\u0631\u062a \u0631\u0627 \u0645\u06cc \u062a\u0648\u0627\u0646 \u0628\u062f\u0648\u0646 \u062a\u063a\u06cc\u06cc\u0631 \u062f\u0631 \u0631\u0641\u062a\u0627\u0631 \u0628\u0631\u0646\u0627\u0645\u0647 \u0628\u0627 \u0645\u0642\u062f\u0627\u0631 \u0622\u0646 \u062c\u0627\u06cc\u06af\u0632\u06cc\u0646 \u06a9\u0631\u062f.<\/p>\n<\/li>\n<\/ul>\n<p>\u0627\u06a9\u0646\u0648\u0646 \u06a9\u0647 \u0645\u0648\u0636\u0648\u0639\u0627\u062a \u067e\u0627\u0631\u0627\u062f\u0627\u06cc\u0645 \u0647\u0627\u06cc \u0627\u0635\u0644\u06cc \u0631\u0627 \u0645\u0631\u0648\u0631 \u06a9\u0631\u062f\u06cc\u0645\u060c \u0622\u0645\u0627\u062f\u0647 \u0628\u0631\u0631\u0633\u06cc \u0628\u0631\u062e\u06cc \u0627\u0632 \u0627\u0644\u06af\u0648\u0647\u0627\u06cc \u0628\u0648\u06cc \u0631\u0627\u06cc\u062c \u0647\u0633\u062a\u06cc\u0645\u060c \u0627\u0645\u0627 \u0642\u0628\u0644 \u0627\u0632 \u0622\u0646\u060c \u0645\u06cc \u062e\u0648\u0627\u0647\u0645 \u0645\u0642\u062f\u0645\u0627\u062a \u0628\u0631\u062a\u0631 \u062e\u0648\u062f \u0631\u0627 \u0647\u0646\u06af\u0627\u0645 \u06a9\u062f\u0646\u0648\u06cc\u0633\u06cc \u0627\u0631\u0627\u0626\u0647 \u06a9\u0646\u0645.<\/p>\n<ul>\n<li>\n<p>\u0645\u0642\u062f\u0627\u0631 \u0646\u062d\u0648 \u0627\u0633\u062a\u0641\u0627\u062f\u0647 \u0634\u062f\u0647 \u0631\u0627 (\u062a\u0627 \u062d\u062f \u0627\u0645\u06a9\u0627\u0646) \u0628\u0647 \u062d\u062f\u0627\u0642\u0644 \u0628\u0631\u0633\u0627\u0646\u06cc\u062f.<\/p>\n<\/li>\n<li>\n<p>\u0627\u0632 \u062a\u0639\u0631\u06cc\u0641 \u067e\u0627\u0631\u0627\u0645\u062a\u0631\u0647\u0627\u06cc \u063a\u06cc\u0631 \u0636\u0631\u0648\u0631\u06cc \u062e\u0648\u062f\u062f\u0627\u0631\u06cc \u06a9\u0646\u06cc\u062f.<\/p>\n<\/li>\n<li>\n<p>\u062a\u0648\u0627\u0628\u0639\/\u0631\u0648\u0634 \u0647\u0627 \u0631\u0627 \u06a9\u0648\u0686\u06a9 \u0646\u06af\u0647 \u062f\u0627\u0631\u06cc\u062f \u0648 \u0631\u0648\u06cc \u062a\u06a9 \u0645\u0646\u0638\u0648\u0631\u0647 \u0645\u062a\u0645\u0631\u06a9\u0632 \u06a9\u0646\u06cc\u062f (\u062f\u0631 \u0635\u0648\u0631\u062a \u0627\u0645\u06a9\u0627\u0646 \u062f\u0631\u0648\u0646 \u062e\u0637\u06cc).<\/p>\n<\/li>\n<li>\n<p>\u0637\u0631\u0627\u062d\u06cc \u0628\u0627 \u0627\u0633\u062a\u0641\u0627\u062f\u0647 \u0627\u0632 \u062a\u063a\u06cc\u06cc\u0631 \u0646\u0627\u067e\u0630\u06cc\u0631\u06cc \u0648 \u062a\u063a\u06cc\u06cc\u0631\u067e\u0630\u06cc\u0631\u06cc \u062a\u0631\u06a9 \u0641\u0642\u0637 \u0628\u0631\u0627\u06cc \u0645\u0648\u0627\u0631\u062f \u062e\u0627\u0635 (\u06a9\u067e\u0633\u0648\u0644\u0647 \u0634\u062f\u0647).<\/p>\n<\/li>\n<li>\n<p>\u0627\u0632 \u0646\u0627\u0645 \u0647\u0627\u06cc \u062a\u0648\u0635\u06cc\u0641\u06cc \u0628\u0631\u0627\u06cc \u062a\u0648\u0627\u0628\u0639\u060c \u0645\u062a\u062f\u0647\u0627\u060c \u06a9\u0644\u0627\u0633 \u0647\u0627 \u0648 \u062b\u0627\u0628\u062a \u0647\u0627 \u0627\u0633\u062a\u0641\u0627\u062f\u0647 \u06a9\u0646\u06cc\u062f.<\/p>\n<\/li>\n<li>\n<p>\u0627\u0632 \u0627\u0633\u062a\u0641\u0627\u062f\u0647 \u0627\u0632 \u06a9\u0644\u0645\u0627\u062a \u06a9\u0644\u06cc\u062f\u06cc \u062a\u06a9\u0631\u0627\u0631 \u062f\u0627\u062e\u0644\u06cc \u062e\u0648\u062f\u062f\u0627\u0631\u06cc \u06a9\u0646\u06cc\u062f (\u0645\u06af\u0631 \u0627\u06cc\u0646\u06a9\u0647 \u0627\u0633\u062a\u0641\u0627\u062f\u0647 \u0627\u0632 \u06cc\u06a9 \u062a\u0627\u0628\u0639 \u0645\u0631\u062a\u0628\u0647 \u0628\u0627\u0644\u0627 \u0631\u0627\u0647 \u062d\u0644 \u0631\u0627 \u0628\u062f\u062a\u0631 \u06a9\u0646\u062f).<\/p>\n<\/li>\n<li>\n<p>\u0647\u0632\u06cc\u0646\u0647 \u0645\u062d\u0627\u0633\u0628\u0627\u062a\u06cc \u0631\u0627 \u0647\u0645\u06cc\u0634\u0647 \u062f\u0631 \u0646\u0638\u0631 \u062f\u0627\u0634\u062a\u0647 \u0628\u0627\u0634\u06cc\u062f.<\/p>\n<\/li>\n<li>\n<p>\u06a9\u062f \u0628\u0627\u06cc\u062f \u062e\u0648\u062f\u0634 \u062a\u0648\u0636\u06cc\u062d \u062f\u0647\u062f.<\/p>\n<\/li>\n<\/ul>\n<p><strong>\u062a\u0648\u062c\u0647 \u062f\u0627\u0634\u062a\u0647 \u0628\u0627\u0634\u06cc\u062f<\/strong>: \u0645\u0646 \u0627\u0632 *NodeJs *\u0628\u0631\u0627\u06cc \u0627\u06cc\u0646 \u0645\u062b\u0627\u0644 \u0647\u0627 \u0628\u0647 \u062f\u0644\u06cc\u0644 \u0627\u0645\u06a9\u0627\u0646\u0627\u062a \u0627\u0633\u062a\u0641\u0627\u062f\u0647 \u062e\u0648\u0627\u0647\u0645 \u06a9\u0631\u062f\u060c \u0627\u06af\u0631\u0686\u0647 \u0627\u06cc\u0646 \u0627\u06cc\u062f\u0647 \u0647\u0627 \u0628\u0627\u06cc\u062f \u0628\u0647 \u0631\u0627\u062d\u062a\u06cc \u0628\u0627 \u0627\u0633\u062a\u0641\u0627\u062f\u0647 \u0627\u0632 \u0647\u0631 \u0632\u0628\u0627\u0646 \u0628\u0631\u0646\u0627\u0645\u0647 \u0646\u0648\u06cc\u0633\u06cc \u062f\u06cc\u06af\u0631\u06cc \u06a9\u0647 \u0628\u0647 \u0645\u0627 \u0627\u0645\u06a9\u0627\u0646 \u0627\u0633\u062a\u0641\u0627\u062f\u0647 \u0627\u0632 \u067e\u0627\u0631\u0627\u062f\u0627\u06cc\u0645 \u0647\u0627\u06cc OOP \u0648 FP \u0631\u0627 \u0645\u06cc \u062f\u0647\u062f\u060c \u067e\u06cc\u0627\u062f\u0647 \u0633\u0627\u0632\u06cc \u0634\u0648\u0646\u062f.<\/p>\n<p><strong>Complex if then else \u0648 \u0633\u0648\u0626\u06cc\u0686 \u0645\u0648\u0627\u0631\u062f<\/strong><\/p>\n<p>\u0686\u0646\u062f\u06cc\u0646 \u0628\u0627\u0631 \u06a9\u062f\u06cc \u0628\u0627 \u0634\u0631\u0627\u06cc\u0637 \u062a\u0648 \u062f\u0631 \u062a\u0648 \u06cc\u0627 \u0645\u0648\u0627\u0631\u062f \u0633\u0648\u0626\u06cc\u0686 \u0645\u06cc \u0628\u06cc\u0646\u0645 \u06a9\u0647 \u062f\u0631\u06a9 \u0648 \u062d\u0641\u0638 \u0645\u0646\u0637\u0642 \u0631\u0627 \u0633\u062e\u062a \u0645\u06cc \u06a9\u0646\u062f<\/p>\n<div class=\"highlight js-code-highlight\">\n<pre class=\"highlight plaintext\"><code>const reactByAction = action =&gt; {\n  switch (action.type) {\n    case 'A':\n      return calculateA(action)\n    case 'B':\n      return calculateB(action)\n    case 'C':\n      return calculateC(action)\n    default:\n      return \/\/ Do nothing\n  }\n}\n<\/code><\/pre>\n<div class=\"highlight__panel js-actions-panel\">\n<div class=\"highlight__panel-action js-fullscreen-code-action\">\n    <svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"20px\" height=\"20px\" viewbox=\"0 0 24 24\" class=\"highlight-action crayons-icon highlight-action--fullscreen-on\"><title>\u0648\u0627\u0631\u062f \u062d\u0627\u0644\u062a \u062a\u0645\u0627\u0645 \u0635\u0641\u062d\u0647 \u0634\u0648\u06cc\u062f<\/title>\n    <path d=\"M16 3h6v6h-2V5h-4V3zM2 3h6v2H4v4H2V3zm18 16v-4h2v6h-6v-2h4zM4 19h4v2H2v-6h2v4z\"\/>\n<\/svg><\/p>\n<p>    <svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"20px\" height=\"20px\" viewbox=\"0 0 24 24\" class=\"highlight-action crayons-icon highlight-action--fullscreen-off\"><title>\u0627\u0632 \u062d\u0627\u0644\u062a \u062a\u0645\u0627\u0645 \u0635\u0641\u062d\u0647 \u062e\u0627\u0631\u062c \u0634\u0648\u06cc\u062f<\/title>\n    <path d=\"M18 7h4v2h-6V3h2v4zM8 9H2V7h4V3h2v6zm10 8v4h-2v-6h6v2h-4zM8 15v6H6v-4H2v-2h6z\"\/>\n<\/svg><\/p>\n<\/div>\n<\/div>\n<\/div>\n<p>\u062f\u0631 \u0627\u06cc\u0646\u062c\u0627 \u0645\u06cc \u062a\u0648\u0627\u0646\u06cc\u0645 \u0628\u06cc\u0646 \u062f\u0648 \u0631\u0648\u06cc\u06a9\u0631\u062f \u06cc\u06a9\u06cc \u0631\u0627 \u0627\u0646\u062a\u062e\u0627\u0628 \u06a9\u0646\u06cc\u0645.  \u0645\u0627 \u0645\u06cc\u200c\u062a\u0648\u0627\u0646\u06cc\u0645 \u062a\u0635\u0645\u06cc\u0645 \u0628\u06af\u06cc\u0631\u06cc\u0645 \u0627\u0632 *Polymorphism *\u06a9\u0644\u0627\u0633\u06cc\u06a9 \u062f\u0631 OOP \u0627\u0633\u062a\u0641\u0627\u062f\u0647 \u06a9\u0646\u06cc\u0645 \u0648 \u0645\u0633\u0626\u0648\u0644\u06cc\u062a \u0622\u0646 \u0645\u062d\u0627\u0633\u0628\u0627\u062a \u0631\u0627 \u0628\u0647 \u0647\u0631 \u0646\u0645\u0627\u06cc\u0634 \u0639\u0645\u0644\u06cc \u0645\u062d\u0648\u0644 \u06a9\u0646\u06cc\u0645.<\/p>\n<div class=\"highlight js-code-highlight\">\n<pre class=\"highlight plaintext\"><code>const reactByAction = action =&gt; action.calculate()\n<\/code><\/pre>\n<div class=\"highlight__panel js-actions-panel\">\n<div class=\"highlight__panel-action js-fullscreen-code-action\">\n    <svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"20px\" height=\"20px\" viewbox=\"0 0 24 24\" class=\"highlight-action crayons-icon highlight-action--fullscreen-on\"><title>\u0648\u0627\u0631\u062f \u062d\u0627\u0644\u062a \u062a\u0645\u0627\u0645 \u0635\u0641\u062d\u0647 \u0634\u0648\u06cc\u062f<\/title>\n    <path d=\"M16 3h6v6h-2V5h-4V3zM2 3h6v2H4v4H2V3zm18 16v-4h2v6h-6v-2h4zM4 19h4v2H2v-6h2v4z\"\/>\n<\/svg><\/p>\n<p>    <svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"20px\" height=\"20px\" viewbox=\"0 0 24 24\" class=\"highlight-action crayons-icon highlight-action--fullscreen-off\"><title>\u0627\u0632 \u062d\u0627\u0644\u062a \u062a\u0645\u0627\u0645 \u0635\u0641\u062d\u0647 \u062e\u0627\u0631\u062c \u0634\u0648\u06cc\u062f<\/title>\n    <path d=\"M18 7h4v2h-6V3h2v4zM8 9H2V7h4V3h2v6zm10 8v4h-2v-6h6v2h-4zM8 15v6H6v-4H2v-2h6z\"\/>\n<\/svg><\/p>\n<\/div>\n<\/div>\n<\/div>\n<p>\u062c\u0627\u06cc\u06cc \u06a9\u0647 \u0647\u0631 \u0639\u0645\u0644 \u0645\u06cc \u062f\u0627\u0646\u062f \u0686\u06af\u0648\u0646\u0647 \u0628\u0627\u06cc\u062f \u0645\u062d\u0627\u0633\u0628\u0647 \u0634\u0648\u062f<\/p>\n<p>` \u0627\u06a9\u0634\u0646 \u06a9\u0644\u0627\u0633 \u0627\u0646\u062a\u0632\u0627\u0639\u06cc {<br \/>\u0645\u062d\u0627\u0633\u0628\u0647 \u0627\u0646\u062a\u0632\u0627\u0639\u06cc()<br \/>}<\/p>\n<div class=\"highlight js-code-highlight\">\n<pre class=\"highlight plaintext\"><code>class ActionA extends Action {\n    calculate() {\n        ...\n    }\n}\n\nclass ActionB extends Action {\n    calculate() {\n        ...\n    }\n}\n\n...`\n<\/code><\/pre>\n<div class=\"highlight__panel js-actions-panel\">\n<div class=\"highlight__panel-action js-fullscreen-code-action\">\n    <svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"20px\" height=\"20px\" viewbox=\"0 0 24 24\" class=\"highlight-action crayons-icon highlight-action--fullscreen-on\"><title>\u0648\u0627\u0631\u062f \u062d\u0627\u0644\u062a \u062a\u0645\u0627\u0645 \u0635\u0641\u062d\u0647 \u0634\u0648\u06cc\u062f<\/title>\n    <path d=\"M16 3h6v6h-2V5h-4V3zM2 3h6v2H4v4H2V3zm18 16v-4h2v6h-6v-2h4zM4 19h4v2H2v-6h2v4z\"\/>\n<\/svg><\/p>\n<p>    <svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"20px\" height=\"20px\" viewbox=\"0 0 24 24\" class=\"highlight-action crayons-icon highlight-action--fullscreen-off\"><title>\u0627\u0632 \u062d\u0627\u0644\u062a \u062a\u0645\u0627\u0645 \u0635\u0641\u062d\u0647 \u062e\u0627\u0631\u062c \u0634\u0648\u06cc\u062f<\/title>\n    <path d=\"M18 7h4v2h-6V3h2v4zM8 9H2V7h4V3h2v6zm10 8v4h-2v-6h6v2h-4zM8 15v6H6v-4H2v-2h6z\"\/>\n<\/svg><\/p>\n<\/div>\n<\/div>\n<\/div>\n<p>\u0627\u0645\u0627\u060c \u062f\u0631 \u0648\u0627\u0642\u0639\u060c \u06af\u0627\u0647\u06cc \u0627\u0648\u0642\u0627\u062a \u062a\u0635\u0648\u0631 \u0645\u06cc\u200c\u0634\u062f \u06a9\u0647 \u0631\u0627\u0647\u200c\u062d\u0644\u200c\u0647\u0627\u06cc \u0645\u0627 \u0645\u0627\u0646\u0646\u062f \u0627\u0634\u06cc\u0627\u0621 \u0646\u0645\u0648\u0646\u0647 \u0631\u0641\u062a\u0627\u0631 \u0646\u0645\u06cc\u200c\u0634\u0648\u0646\u062f.  \u062f\u0631 \u0627\u06cc\u0646 \u062d\u0627\u0644\u062a \u0645\u06cc \u062a\u0648\u0627\u0646\u06cc\u0645 \u0627\u0632 \u0646\u06af\u0627\u0634\u062a \u0634\u06cc\u0621 \u06a9\u0644\u0627\u0633\u06cc\u06a9 \u0648 <em>\u0634\u0641\u0627\u0641\u06cc\u062a \u0627\u0631\u062c\u0627\u0639\u06cc<\/em>\u060c \u06a9\u0647 \u0645\u0627\u0646\u0646\u062f \u06cc\u06a9 \u0633\u0648\u0626\u06cc\u0686 \u063a\u06cc\u0631 \u0645\u0633\u062a\u0642\u06cc\u0645 \u06a9\u0627\u0631 \u0645\u06cc \u06a9\u0646\u062f\u060c \u0627\u0645\u0627 \u0628\u0647 \u0645\u0627 \u0627\u062c\u0627\u0632\u0647 \u0645\u06cc \u062f\u0647\u062f \u062a\u0627 \u0645\u0648\u0627\u0631\u062f \u067e\u06cc\u0686\u06cc\u062f\u0647 \u0631\u0627 \u062d\u0630\u0641 \u06a9\u0646\u06cc\u0645<\/p>\n<p><code>const calculateAction = {<br \/>A: action =&gt; ...,<br \/>B: action =&gt; ...,<br \/>C: action =&gt; ...,<br \/>}<\/code><\/p>\n<div class=\"highlight js-code-highlight\">\n<pre class=\"highlight plaintext\"><code>const reactByAction = action =&gt; calculateAction?.[action.type](action)\n<\/code><\/pre>\n<div class=\"highlight__panel js-actions-panel\">\n<div class=\"highlight__panel-action js-fullscreen-code-action\">\n    <svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"20px\" height=\"20px\" viewbox=\"0 0 24 24\" class=\"highlight-action crayons-icon highlight-action--fullscreen-on\"><title>\u0648\u0627\u0631\u062f \u062d\u0627\u0644\u062a \u062a\u0645\u0627\u0645 \u0635\u0641\u062d\u0647 \u0634\u0648\u06cc\u062f<\/title>\n    <path d=\"M16 3h6v6h-2V5h-4V3zM2 3h6v2H4v4H2V3zm18 16v-4h2v6h-6v-2h4zM4 19h4v2H2v-6h2v4z\"\/>\n<\/svg><\/p>\n<p>    <svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"20px\" height=\"20px\" viewbox=\"0 0 24 24\" class=\"highlight-action crayons-icon highlight-action--fullscreen-off\"><title>\u0627\u0632 \u062d\u0627\u0644\u062a \u062a\u0645\u0627\u0645 \u0635\u0641\u062d\u0647 \u062e\u0627\u0631\u062c \u0634\u0648\u06cc\u062f<\/title>\n    <path d=\"M18 7h4v2h-6V3h2v4zM8 9H2V7h4V3h2v6zm10 8v4h-2v-6h6v2h-4zM8 15v6H6v-4H2v-2h6z\"\/>\n<\/svg><\/p>\n<\/div>\n<\/div>\n<\/div>\n<p>\u0627\u0644\u0628\u062a\u0647\u060c \u0627\u06cc\u0646 \u06cc\u06a9 \u0645\u062d\u062f\u0648\u062f\u06cc\u062a \u062f\u0627\u0631\u062f\u060c \u0647\u0631 \u0628\u0627\u0631 \u06a9\u0647 \u0634\u0645\u0627 \u0646\u06cc\u0627\u0632 \u0628\u0647 &#8220;\u0634\u0646\u0627\u0633\u0627\u06cc\u06cc&#8221; \u06cc\u06a9 \u0646\u0648\u0639 \u0639\u0645\u0644 \u062f\u0627\u0631\u06cc\u062f\u060c \u0628\u0627\u06cc\u062f \u06cc\u06a9 \u0646\u06af\u0627\u0634\u062a \u0634\u06cc \u062b\u0627\u0628\u062a \u062c\u062f\u06cc\u062f \u0627\u06cc\u062c\u0627\u062f \u06a9\u0646\u06cc\u062f.<\/p>\n<p>\u0647\u0631 \u0631\u0627\u0647 \u062d\u0644\u06cc \u06a9\u0647 \u0627\u0646\u062a\u062e\u0627\u0628 \u0645\u06cc\u200c\u0634\u0648\u062f\u060c \u0647\u0645\u06cc\u0634\u0647 \u0645\u06cc\u200c\u062e\u0648\u0627\u0647\u06cc\u062f \u0622\u0646 \u0631\u0627 \u0633\u0627\u062f\u0647 \u0646\u06af\u0647 \u062f\u0627\u0631\u06cc\u062f\u060c \u0645\u0633\u0626\u0648\u0644\u06cc\u062a\u200c\u0647\u0627 \u0631\u0627 \u0628\u0647 \u0628\u0647\u062a\u0631\u06cc\u0646 \u0634\u06a9\u0644 \u0645\u0645\u06a9\u0646 \u0645\u062d\u0648\u0644 \u06a9\u0646\u06cc\u062f\u060c \u062a\u0639\u062f\u0627\u062f \u062e\u0637\u0648\u0637 \u0631\u0627\u0647\u200c\u062d\u0644 \u062e\u0648\u062f \u0631\u0627 \u062a\u0648\u0632\u06cc\u0639 \u06a9\u0646\u06cc\u062f \u0648 \u0627\u0632 \u06cc\u06a9 \u0646\u0627\u0645 \u062a\u0648\u0636\u06cc\u062d\u06cc \u062e\u0648\u0628 \u0628\u0631\u0627\u06cc \u0633\u0627\u062f\u0647\u200c\u0633\u0627\u0632\u06cc \u062f\u0631\u06a9\/\u0645\u0642\u06cc\u0627\u0633\u200c\u067e\u0630\u06cc\u0631\u06cc \u0627\u0633\u062a\u0641\u0627\u062f\u0647 \u06a9\u0646\u06cc\u062f.<\/p>\n<p>\u0627\u06af\u0631 \u0646\u0645\u06cc \u062a\u0648\u0627\u0646\u06cc\u062f \u06cc\u06a9 \u0646\u0645\u0648\u0646\u0647 \u0627\u0632 \u0647\u0631 \u0639\u0645\u0644 \u0627\u0631\u0627\u0626\u0647 \u062f\u0647\u06cc\u062f\u060c \u067e\u06cc\u0634\u0646\u0647\u0627\u062f \u0645\u06cc \u06a9\u0646\u0645 \u067e\u06cc\u0627\u062f\u0647 \u0633\u0627\u0632\u06cc \u0630\u0648\u0628 \u0634\u062f\u0647 \u0631\u0627 \u0627\u062c\u0631\u0627 \u06a9\u0646\u06cc\u062f<\/p>\n<p>` \u06a9\u0644\u0627\u0633 Handler {<br \/>\u0633\u0627\u0632\u0646\u062f\u0647() {<br \/>this.actionMap = {<br \/>A: action => new ActionA(action)\u060c<br \/>B: action => new ActionB(action)<br \/>C: action => new ActionC(action)<br \/>};<br \/>}<\/p>\n<div class=\"highlight js-code-highlight\">\n<pre class=\"highlight plaintext\"><code>  reactByAction = action =&gt; this.actionMap[action.type]?.(action).calculate()\n}`\n<\/code><\/pre>\n<div class=\"highlight__panel js-actions-panel\">\n<div class=\"highlight__panel-action js-fullscreen-code-action\">\n    <svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"20px\" height=\"20px\" viewbox=\"0 0 24 24\" class=\"highlight-action crayons-icon highlight-action--fullscreen-on\"><title>\u0648\u0627\u0631\u062f \u062d\u0627\u0644\u062a \u062a\u0645\u0627\u0645 \u0635\u0641\u062d\u0647 \u0634\u0648\u06cc\u062f<\/title>\n    <path d=\"M16 3h6v6h-2V5h-4V3zM2 3h6v2H4v4H2V3zm18 16v-4h2v6h-6v-2h4zM4 19h4v2H2v-6h2v4z\"\/>\n<\/svg><\/p>\n<p>    <svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"20px\" height=\"20px\" viewbox=\"0 0 24 24\" class=\"highlight-action crayons-icon highlight-action--fullscreen-off\"><title>\u0627\u0632 \u062d\u0627\u0644\u062a \u062a\u0645\u0627\u0645 \u0635\u0641\u062d\u0647 \u062e\u0627\u0631\u062c \u0634\u0648\u06cc\u062f<\/title>\n    <path d=\"M18 7h4v2h-6V3h2v4zM8 9H2V7h4V3h2v6zm10 8v4h-2v-6h6v2h-4zM8 15v6H6v-4H2v-2h6z\"\/>\n<\/svg><\/p>\n<\/div>\n<\/div>\n<\/div>\n<p><strong>\u062a\u0639\u0627\u0631\u06cc\u0641 \u067e\u0627\u0631\u0627\u0645\u062a\u0631\u0647\u0627\u06cc \u063a\u06cc\u0631 \u0636\u0631\u0648\u0631\u06cc<\/strong><\/p>\n<p>\u06af\u0627\u0647\u06cc \u0627\u0648\u0642\u0627\u062a\u060c \u0645\u0627 \u062a\u0648\u0627\u0628\u0639\/\u0631\u0648\u0634 \u0647\u0627\u06cc\u06cc \u0631\u0627 \u0628\u0627 \u067e\u0627\u0631\u0627\u0645\u062a\u0631\u0647\u0627\u06cc \u0632\u06cc\u0627\u062f\u06cc \u06a9\u0647 \u0645\u06cc \u062a\u0648\u0627\u0646\u0646\u062f \u0627\u0632 \u06cc\u06a9 \u0632\u0645\u06cc\u0646\u0647 \u0645\u0634\u062a\u0631\u06a9 \u0645\u0634\u062a\u0642 \u0634\u0648\u0646\u062f\u060c \u067e\u06cc\u0627\u062f\u0647 \u0633\u0627\u0632\u06cc \u0645\u06cc \u06a9\u0646\u06cc\u0645\u060c \u062f\u0631 \u0627\u06cc\u0646\u062c\u0627 \u06cc\u06a9 \u0645\u062b\u0627\u0644 \u0633\u0627\u062f\u0647 \u0648\u062c\u0648\u062f \u062f\u0627\u0631\u062f.<br \/>`<br \/>const totalPrice = (\u0642\u06cc\u0645\u062a\u060c \u0646\u0631\u062e \u0645\u0627\u0644\u06cc\u0627\u062a\u060c \u0646\u0631\u062e \u062a\u062e\u0641\u06cc\u0641) => {<br \/>const taxAmount = \u0642\u06cc\u0645\u062a * \u0646\u0631\u062e \u0645\u0627\u0644\u06cc\u0627\u062a<br \/>const discountAmount = \u0642\u06cc\u0645\u062a * \u0646\u0631\u062e \u062a\u062e\u0641\u06cc\u0641<br \/>\u0642\u06cc\u0645\u062a \u0628\u0627\u0632\u06af\u0634\u062a + \u0645\u0627\u0644\u06cc\u0627\u062a \u0645\u0628\u0644\u063a &#8211; \u062a\u062e\u0641\u06cc\u0641 \u0645\u0628\u0644\u063a<br \/>}<\/p>\n<div class=\"highlight js-code-highlight\">\n<pre class=\"highlight plaintext\"><code>const totalForRegularCustomer = price =&gt; totalPrice(price, 0.1, 0)\nconst totalForPremiumCustomer = price =&gt; totalPrice(price, 0.1, 0.1)`\n<\/code><\/pre>\n<div class=\"highlight__panel js-actions-panel\">\n<div class=\"highlight__panel-action js-fullscreen-code-action\">\n    <svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"20px\" height=\"20px\" viewbox=\"0 0 24 24\" class=\"highlight-action crayons-icon highlight-action--fullscreen-on\"><title>\u0648\u0627\u0631\u062f \u062d\u0627\u0644\u062a \u062a\u0645\u0627\u0645 \u0635\u0641\u062d\u0647 \u0634\u0648\u06cc\u062f<\/title>\n    <path d=\"M16 3h6v6h-2V5h-4V3zM2 3h6v2H4v4H2V3zm18 16v-4h2v6h-6v-2h4zM4 19h4v2H2v-6h2v4z\"\/>\n<\/svg><\/p>\n<p>    <svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"20px\" height=\"20px\" viewbox=\"0 0 24 24\" class=\"highlight-action crayons-icon highlight-action--fullscreen-off\"><title>\u0627\u0632 \u062d\u0627\u0644\u062a \u062a\u0645\u0627\u0645 \u0635\u0641\u062d\u0647 \u062e\u0627\u0631\u062c \u0634\u0648\u06cc\u062f<\/title>\n    <path d=\"M18 7h4v2h-6V3h2v4zM8 9H2V7h4V3h2v6zm10 8v4h-2v-6h6v2h-4zM8 15v6H6v-4H2v-2h6z\"\/>\n<\/svg><\/p>\n<\/div>\n<\/div>\n<\/div>\n<p>\u062a\u0639\u0627\u0631\u06cc\u0641 \u062f\u0631\u0633\u062a \u0647\u0633\u062a\u0646\u062f\u060c \u0627\u0645\u0627 \u0645\u06cc\u200c\u062a\u0648\u0627\u0646\u06cc\u0645 \u062a\u0639\u062f\u0627\u062f \u0645\u0633\u0626\u0648\u0644\u06cc\u062a\u200c\u0647\u0627 \u0631\u0627 \u0628\u0627 \u062c\u062f\u0627 \u06a9\u0631\u062f\u0646 \u062a\u0627\u0628\u0639\u060c \u0628\u0627 \u0627\u0633\u062a\u0641\u0627\u062f\u0647 \u0627\u0632 \u0645\u0641\u0647\u0648\u0645 Currying \u0648 \u06a9\u0644\u0627\u0633\u200c\u0647\u0627 \u0628\u0631\u0627\u06cc \u0645\u062d\u0635\u0648\u0631 \u06a9\u0631\u062f\u0646 \u062c\u0632\u0626\u06cc\u0627\u062a \u0648 \u0627\u06cc\u062c\u0627\u062f \u0631\u0648\u0634\u200c\u0647\u0627\u06cc \u062a\u062e\u0635\u0635\u06cc\u200c\u062a\u0631 \u0633\u0627\u062f\u0647\u200c\u0633\u0627\u0632\u06cc \u06a9\u0646\u06cc\u0645.<\/p>\n<p>\u062f\u0631 \u0627\u06cc\u0646\u062c\u0627 \u06cc\u06a9 \u067e\u06cc\u0634\u0646\u0647\u0627\u062f \u0633\u0627\u062f\u0647 \u0628\u0627 \u0627\u0633\u062a\u0641\u0627\u062f\u0647 \u0627\u0632 OOP \u0648\u062c\u0648\u062f \u062f\u0627\u0631\u062f<\/p>\n<p>` \u0645\u0634\u062a\u0631\u06cc \u06a9\u0644\u0627\u0633 {<br \/>taxAmount = \u0642\u06cc\u0645\u062a => \u0642\u06cc\u0645\u062a * this.taxRate()<br \/>discountAmount = \u0642\u06cc\u0645\u062a => \u0642\u06cc\u0645\u062a * this.discountRate()<br \/>totalPrice = \u0642\u06cc\u0645\u062a => \u0642\u06cc\u0645\u062a + this.taxAmount(price) &#8211; this.discountAmount(price)<br \/>}<\/p>\n<div class=\"highlight js-code-highlight\">\n<pre class=\"highlight plaintext\"><code>class RegularCustomer extends Customer {\n  taxRate = () =&gt; 0.1\n  discountRate = () =&gt; 0\n}\n\nclass PremiumCustomer extends Customer {\n  taxRate = () =&gt; 0.05\n  discountRate = () =&gt; 0.1\n}`\n<\/code><\/pre>\n<div class=\"highlight__panel js-actions-panel\">\n<div class=\"highlight__panel-action js-fullscreen-code-action\">\n    <svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"20px\" height=\"20px\" viewbox=\"0 0 24 24\" class=\"highlight-action crayons-icon highlight-action--fullscreen-on\"><title>\u0648\u0627\u0631\u062f \u062d\u0627\u0644\u062a \u062a\u0645\u0627\u0645 \u0635\u0641\u062d\u0647 \u0634\u0648\u06cc\u062f<\/title>\n    <path d=\"M16 3h6v6h-2V5h-4V3zM2 3h6v2H4v4H2V3zm18 16v-4h2v6h-6v-2h4zM4 19h4v2H2v-6h2v4z\"\/>\n<\/svg><\/p>\n<p>    <svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"20px\" height=\"20px\" viewbox=\"0 0 24 24\" class=\"highlight-action crayons-icon highlight-action--fullscreen-off\"><title>\u0627\u0632 \u062d\u0627\u0644\u062a \u062a\u0645\u0627\u0645 \u0635\u0641\u062d\u0647 \u062e\u0627\u0631\u062c \u0634\u0648\u06cc\u062f<\/title>\n    <path d=\"M18 7h4v2h-6V3h2v4zM8 9H2V7h4V3h2v6zm10 8v4h-2v-6h6v2h-4zM8 15v6H6v-4H2v-2h6z\"\/>\n<\/svg><\/p>\n<\/div>\n<\/div>\n<\/div>\n<p>\u062a\u0648\u062c\u0647 \u062f\u0627\u0634\u062a\u0647 \u0628\u0627\u0634\u06cc\u062f \u06a9\u0647 \u0645\u0646 \u0627\u0632 \u0631\u0648\u0634 \u0627\u0644\u06af\u0648\u06cc \u0627\u0644\u06af\u0648 \u0627\u0633\u062a\u0641\u0627\u062f\u0647 \u06a9\u0631\u062f\u0645 \ud83d\ude42<\/p>\n<p>\u0648 \u062f\u0631 \u0627\u06cc\u0646\u062c\u0627 \u06af\u0632\u06cc\u0646\u0647 \u062f\u06cc\u06af\u0631\u06cc \u0628\u0627 \u0627\u0633\u062a\u0641\u0627\u062f\u0647 \u0627\u0632 FP \u0648\u062c\u0648\u062f \u062f\u0627\u0631\u062f<\/p>\n<p>` \u0645\u0627\u0644\u06cc\u0627\u062a \u0628\u0631 \u0647\u0632\u06cc\u0646\u0647 = \u0646\u0631\u062e \u0645\u0627\u0644\u06cc\u0627\u062a => \u0642\u06cc\u0645\u062a => \u0642\u06cc\u0645\u062a * \u0646\u0631\u062e \u0645\u0627\u0644\u06cc\u0627\u062a<br \/>const discount = discountRate => price => price * discountRate<\/p>\n<div class=\"highlight js-code-highlight\">\n<pre class=\"highlight plaintext\"><code>const regularTaxAmout = tax(0.1)\nconst premiumTaxAmout = tax(0.05)\nconst regularDiscount = discount(0)\nconst premiumDiscount = discount(0.1)\n\nconst calculationWithRates = (taxRateFunc, discountRateFunc) =&gt; price =&gt;\n  price + taxRateFunc(price) - discountRateFunc(price)\n\nconst totalForRegularCustomer = calculationWithRates(regularTaxAmout, regularDiscount)\nconst totalForPremiumCustomer = calculationWithRates(premiumTaxAmout, premiumDiscount)`\n<\/code><\/pre>\n<div class=\"highlight__panel js-actions-panel\">\n<div class=\"highlight__panel-action js-fullscreen-code-action\">\n    <svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"20px\" height=\"20px\" viewbox=\"0 0 24 24\" class=\"highlight-action crayons-icon highlight-action--fullscreen-on\"><title>\u0648\u0627\u0631\u062f \u062d\u0627\u0644\u062a \u062a\u0645\u0627\u0645 \u0635\u0641\u062d\u0647 \u0634\u0648\u06cc\u062f<\/title>\n    <path d=\"M16 3h6v6h-2V5h-4V3zM2 3h6v2H4v4H2V3zm18 16v-4h2v6h-6v-2h4zM4 19h4v2H2v-6h2v4z\"\/>\n<\/svg><\/p>\n<p>    <svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"20px\" height=\"20px\" viewbox=\"0 0 24 24\" class=\"highlight-action crayons-icon highlight-action--fullscreen-off\"><title>\u0627\u0632 \u062d\u0627\u0644\u062a \u062a\u0645\u0627\u0645 \u0635\u0641\u062d\u0647 \u062e\u0627\u0631\u062c \u0634\u0648\u06cc\u062f<\/title>\n    <path d=\"M18 7h4v2h-6V3h2v4zM8 9H2V7h4V3h2v6zm10 8v4h-2v-6h6v2h-4zM8 15v6H6v-4H2v-2h6z\"\/>\n<\/svg><\/p>\n<\/div>\n<\/div>\n<\/div>\n<p>\u062a\u0648\u062c\u0647 \u062f\u0627\u0634\u062a\u0647 \u0628\u0627\u0634\u06cc\u062f \u06a9\u0647 \u0645\u0646 \u062a\u0648\u0627\u0628\u0639 \u0631\u0627 \u0628\u0631\u0627\u06cc \u0627\u0631\u0627\u0626\u0647 \u0627\u0646\u062a\u0632\u0627\u0639\u0627\u062a \u0628\u06cc\u0634\u062a\u0631 \u0648 \u0627\u0641\u0632\u0627\u06cc\u0634 \u0642\u0627\u0628\u0644\u06cc\u062a \u0627\u0639\u0644\u0627\u0646 \u0627\u0646\u062c\u0627\u0645 \u0645\u06cc \u062f\u0647\u0645<\/p>\n<p>\u0628\u0627\u0632 \u0647\u0645\u060c \u0645\u0627 \u0645\u06cc \u062a\u0648\u0627\u0646\u06cc\u0645 \u0647\u0631 \u062f\u0648 \u067e\u0627\u0631\u0627\u062f\u0627\u06cc\u0645 \u0631\u0627 \u062f\u0631 \u06cc\u06a9 \u0637\u0631\u062d \u062a\u0631\u06a9\u06cc\u0628\u06cc \u062a\u0631\u06a9\u06cc\u0628 \u06a9\u0646\u06cc\u0645 \ud83d\ude42<\/p>\n<p>` \u0645\u0634\u062a\u0631\u06cc \u06a9\u0644\u0627\u0633 {<br \/>\u0633\u0627\u0632\u0646\u062f\u0647 (\u0646\u0631\u062e \u0645\u0627\u0644\u06cc\u0627\u062a\u060c \u0646\u0631\u062e \u062a\u062e\u0641\u06cc\u0641) {<br \/>this.taxRate = taxRate<br \/>this.discountRate = discountRate<br \/>}<\/p>\n<div class=\"highlight js-code-highlight\">\n<pre class=\"highlight plaintext\"><code>  totalPrice = price =&gt; price + this.calculateTax(price) - this.calculateDiscount(price)\n\n  calculateTax = price =&gt; price * this.taxRate\n  calculateDiscount = price =&gt; price * this.discountRate\n}\n\nconst regularCustomer = new Customer(0.1, 0)\nconst premiumCustomer = new Customer(0.05, 0.1)\n\nconst total = customer =&gt; customer.totalPrice\n\nconst totalForRegularCustomer = total(regularCustomer)\nconst totalForPremiumCustomer = total(premiumCustomer)`\n<\/code><\/pre>\n<div class=\"highlight__panel js-actions-panel\">\n<div class=\"highlight__panel-action js-fullscreen-code-action\">\n    <svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"20px\" height=\"20px\" viewbox=\"0 0 24 24\" class=\"highlight-action crayons-icon highlight-action--fullscreen-on\"><title>\u0648\u0627\u0631\u062f \u062d\u0627\u0644\u062a \u062a\u0645\u0627\u0645 \u0635\u0641\u062d\u0647 \u0634\u0648\u06cc\u062f<\/title>\n    <path d=\"M16 3h6v6h-2V5h-4V3zM2 3h6v2H4v4H2V3zm18 16v-4h2v6h-6v-2h4zM4 19h4v2H2v-6h2v4z\"\/>\n<\/svg><\/p>\n<p>    <svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"20px\" height=\"20px\" viewbox=\"0 0 24 24\" class=\"highlight-action crayons-icon highlight-action--fullscreen-off\"><title>\u0627\u0632 \u062d\u0627\u0644\u062a \u062a\u0645\u0627\u0645 \u0635\u0641\u062d\u0647 \u062e\u0627\u0631\u062c \u0634\u0648\u06cc\u062f<\/title>\n    <path d=\"M18 7h4v2h-6V3h2v4zM8 9H2V7h4V3h2v6zm10 8v4h-2v-6h6v2h-4zM8 15v6H6v-4H2v-2h6z\"\/>\n<\/svg><\/p>\n<\/div>\n<\/div>\n<\/div>\n<p><strong>\u0631\u0648\u0634\/\u0639\u0645\u0644\u06a9\u0631\u062f\u0647\u0627\u06cc \u0637\u0648\u0644\u0627\u0646\u06cc \u0628\u06cc\u0634 \u0627\u0632 \u062d\u062f<\/strong><\/p>\n<p>\u06a9\u0644\u0627\u0633\u06cc\u06a9 \u062f\u06cc\u06af\u0631\u06cc \u06a9\u0647 \u0645\u0646 \u0628\u0647 \u062f\u06cc\u062f\u0646 \u0622\u0646 \u0639\u0627\u062f\u062a \u062f\u0627\u0631\u0645 \u0631\u0648\u0634 \u0647\u0627 \u0648 \u0639\u0645\u0644\u06a9\u0631\u062f\u0647\u0627\u06cc\u06cc \u0628\u0627 \u0645\u0633\u0626\u0648\u0644\u06cc\u062a \u0647\u0627\u06cc \u0632\u06cc\u0627\u062f\u060c \u0628\u06cc\u0634 \u0627\u0632 \u062d\u062f \u0637\u0648\u0644\u0627\u0646\u06cc\u060c \u0628\u0627 \u0642\u0631\u0627\u0631\u062f\u0627\u062f\u0647\u0627\u06cc \u0633\u062e\u062a \u06a9\u062f\u06af\u0630\u0627\u0631\u06cc \u0634\u062f\u0647 \u0648 \u0642\u0648\u0627\u0646\u06cc\u0646 \u062a\u062c\u0627\u0631\u06cc \u067e\u06cc\u0686\u06cc\u062f\u0647 \u0627\u0633\u062a.<\/p>\n<p>` const tokenize = \u06a9\u062f => {<br \/>let tokens = []\u0627\u062c\u0627\u0632\u0647 \u062f\u0647\u06cc\u062f currentToken = &#8221;<br \/>\u0628\u06af\u0630\u0627\u0631\u06cc\u062f currentType = null<\/p>\n<div class=\"highlight js-code-highlight\">\n<pre class=\"highlight plaintext\"><code>    for (let i = 0; i &lt; code.length; i++) {\n        let char = code[i]\n\n        if (char === ' ' || char === '\n<\/code><\/pre>\n<div class=\"highlight__panel js-actions-panel\">\n<div class=\"highlight__panel-action js-fullscreen-code-action\">\n    <svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"20px\" height=\"20px\" viewbox=\"0 0 24 24\" class=\"highlight-action crayons-icon highlight-action--fullscreen-on\"><title>\u0648\u0627\u0631\u062f \u062d\u0627\u0644\u062a \u062a\u0645\u0627\u0645 \u0635\u0641\u062d\u0647 \u0634\u0648\u06cc\u062f<\/title>\n    <path d=\"M16 3h6v6h-2V5h-4V3zM2 3h6v2H4v4H2V3zm18 16v-4h2v6h-6v-2h4zM4 19h4v2H2v-6h2v4z\"\/>\n<\/svg><\/p>\n<p>    <svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"20px\" height=\"20px\" viewbox=\"0 0 24 24\" class=\"highlight-action crayons-icon highlight-action--fullscreen-off\"><title>\u0627\u0632 \u062d\u0627\u0644\u062a \u062a\u0645\u0627\u0645 \u0635\u0641\u062d\u0647 \u062e\u0627\u0631\u062c \u0634\u0648\u06cc\u062f<\/title>\n    <path d=\"M18 7h4v2h-6V3h2v4zM8 9H2V7h4V3h2v6zm10 8v4h-2v-6h6v2h-4zM8 15v6H6v-4H2v-2h6z\"\/>\n<\/svg><\/p>\n<\/div>\n<\/div>\n<\/div>\n<p>&#8216; ||  \u06a9\u0627\u0631\u0627\u06a9\u062a\u0631 === &#8221;) {<br \/>if (currentToken !== &#8221;) {<br \/>tokens.push({ type: currentType\u060c \u0645\u0642\u062f\u0627\u0631: currentToken })<br \/>CurrentToken = &#8221;<br \/>CurrentType = null<br \/>}<br \/>} else if (char === &#8216;+&#8217; || char === &#8216;-&#8216; || char === &#8216;*&#8217; || char === &#8220;https:\/\/dev.to\/&#8221;) {<br \/>if (currentToken !== &#8221;) {<br \/>tokens.push({ type: currentType\u060c \u0645\u0642\u062f\u0627\u0631: currentToken })<br \/>currentToken = &#8221;<br \/>}<br \/>tokens.push({ type: &#8216;operator&#8217;, value: char });<br \/>} else if (char >= &#8216;0&#8217; &#038;&#038; char <= '9') {<br \/>if (currentType !== &#8216;number&#8217; &#038;&#038; currentToken !== &#8221;) {<br \/>tokens.push({ type: currentType\u060c \u0645\u0642\u062f\u0627\u0631: currentToken })<br \/>CurrentToken = &#8221;<br \/>}<br \/>CurrentType = &#8220;\u0634\u0645\u0627\u0631\u0647&#8221;<br \/>CurrentToken += char<br \/>} else if ((char >= &#8216;a&#8217; &#038;&#038; char <= 'z') || (char >= &#8216;A&#8217; &#038;&#038; char <= 'Z')) {<br \/>if (currentType !== &#8216;\u0634\u0646\u0627\u0633\u0647&#8217; &#038;&#038; currentToken !== &#8221;) {<br \/>tokens.push({ type: currentType\u060c \u0645\u0642\u062f\u0627\u0631: currentToken })<br \/>CurrentToken = &#8221;<br \/>}<br \/>CurrentType = \u0634\u0646\u0627\u0633\u0647<br \/>CurrentToken += char<br \/>}<br \/>}<\/p>\n<div class=\"highlight js-code-highlight\">\n<pre class=\"highlight plaintext\"><code>    if (currentToken !== '') {\n        tokens.push({ type: currentType, value: currentToken })\n    }\n\n    return tokens\n}`\n<\/code><\/pre>\n<div class=\"highlight__panel js-actions-panel\">\n<div class=\"highlight__panel-action js-fullscreen-code-action\">\n    <svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"20px\" height=\"20px\" viewbox=\"0 0 24 24\" class=\"highlight-action crayons-icon highlight-action--fullscreen-on\"><title>\u0648\u0627\u0631\u062f \u062d\u0627\u0644\u062a \u062a\u0645\u0627\u0645 \u0635\u0641\u062d\u0647 \u0634\u0648\u06cc\u062f<\/title>\n    <path d=\"M16 3h6v6h-2V5h-4V3zM2 3h6v2H4v4H2V3zm18 16v-4h2v6h-6v-2h4zM4 19h4v2H2v-6h2v4z\"\/>\n<\/svg><\/p>\n<p>    <svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"20px\" height=\"20px\" viewbox=\"0 0 24 24\" class=\"highlight-action crayons-icon highlight-action--fullscreen-off\"><title>\u0627\u0632 \u062d\u0627\u0644\u062a \u062a\u0645\u0627\u0645 \u0635\u0641\u062d\u0647 \u062e\u0627\u0631\u062c \u0634\u0648\u06cc\u062f<\/title>\n    <path d=\"M18 7h4v2h-6V3h2v4zM8 9H2V7h4V3h2v6zm10 8v4h-2v-6h6v2h-4zM8 15v6H6v-4H2v-2h6z\"\/>\n<\/svg><\/p>\n<\/div>\n<\/div>\n<\/div>\n<p>\u062e\u06cc\u0644\u06cc \u067e\u06cc\u0686\u06cc\u062f\u0647 \u0627\u0633\u062a\u060c \u062f\u0631\u0633\u062a \u0627\u0633\u062a\u061f  \u0641\u0642\u0637 \u0628\u0627 \u062e\u0648\u0627\u0646\u062f\u0646 \u06a9\u062f \u0646\u0645\u06cc \u062a\u0648\u0627\u0646 \u0641\u0647\u0645\u06cc\u062f<\/p>\n<p>\u0628\u06cc\u0627\u06cc\u06cc\u062f \u0627\u062c\u0631\u0627\u06cc \u0645\u062c\u062f\u062f \u0627\u06cc\u0646 \u0631\u0627 \u0628\u0627 \u0627\u0633\u062a\u0641\u0627\u062f\u0647 \u0627\u0632 OOP \u0628\u0628\u06cc\u0646\u06cc\u0645 \u06a9\u0647 \u06cc\u06a9 \u0627\u0646\u062a\u0632\u0627\u0639 \u0627\u06cc\u062c\u0627\u062f \u0645\u06cc \u06a9\u0646\u062f \u0648 \u062a\u063a\u06cc\u06cc\u0631\u067e\u0630\u06cc\u0631\u06cc \u0632\u0645\u06cc\u0646\u0647 \u0631\u0627 \u0645\u062d\u0635\u0648\u0631 \u0645\u06cc \u06a9\u0646\u062f.<\/p>\n<p>Const binaryOperators = [&#8216;+&#8217;, &#8216;-&#8216;, &#8216;*&#8217;, &#8220;https:\/\/dev.to\/&#8221;]\n<div class=\"highlight js-code-highlight\">\n<pre class=\"highlight plaintext\"><code>const SPECIAL_CHARS = {\n    EMPTY_STRING: '',\n    ...\n}\n\nclass Context  {\n    constructor(code) {\n        this.code = code\n        this.tokens = []\n        this.currentToken = ''\n        this.currentType = null\n    }\n\n    ...\n}\n\nclass Tokenizer {\n    constructor(code) { this.context = new Context(code) }\n\n    getCurrentToken() { this.context.getCurrentToken() }\n\n    tokenize() {\n        this.context.getCode().forEach(this.processChar)\n        this.finalizeToken()\n        return this.context.getTokens()\n    }\n\n    processChar(char) {\n        if (this.isWhitespace(char)) {\n            this.finalizeToken()\n        } else {\n            ...\n        }\n    }\n\n    isEmptyChar() {\n        return this.getCurrentToken() == SPECIAL_CHARS.EMPTY_STRING\n    }\n\n    finalizeToken() {\n        if (!isEmptyChar()) {\n            this.addToken(this.context.currentType(), this.currentToken())\n            this.resetCurrentToken()\n        }\n    }\n\n    addToken(type, value) {\n        this.context.addToken({ type, value })\n    }\n\n    resetCurrentToken() {\n        this.context.resetCurrentToken()\n    }\n\n    processDigit(char) {\n        if (!this.context.currentIsNumber()) {\n            this.finalizeToken();\n            this.context.setNumber()\n        }\n\n        this.context.nextChar()\n    }\n\n    processLetter(char) {\n        ...\n    }\n\n    isWhitespace = char =&gt; char === SPECIAL_CHARS.SPACE || char === SPECIAL_CHARS.JUMP || char === SPECIAL_CHARS.TAB\n\n    isOperator = binaryOperators.includes\n\n    ...\n}`\n<\/code><\/pre>\n<div class=\"highlight__panel js-actions-panel\">\n<div class=\"highlight__panel-action js-fullscreen-code-action\">\n    <svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"20px\" height=\"20px\" viewbox=\"0 0 24 24\" class=\"highlight-action crayons-icon highlight-action--fullscreen-on\"><title>\u0648\u0627\u0631\u062f \u062d\u0627\u0644\u062a \u062a\u0645\u0627\u0645 \u0635\u0641\u062d\u0647 \u0634\u0648\u06cc\u062f<\/title>\n    <path d=\"M16 3h6v6h-2V5h-4V3zM2 3h6v2H4v4H2V3zm18 16v-4h2v6h-6v-2h4zM4 19h4v2H2v-6h2v4z\"\/>\n<\/svg><\/p>\n<p>    <svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"20px\" height=\"20px\" viewbox=\"0 0 24 24\" class=\"highlight-action crayons-icon highlight-action--fullscreen-off\"><title>\u0627\u0632 \u062d\u0627\u0644\u062a \u062a\u0645\u0627\u0645 \u0635\u0641\u062d\u0647 \u062e\u0627\u0631\u062c \u0634\u0648\u06cc\u062f<\/title>\n    <path d=\"M18 7h4v2h-6V3h2v4zM8 9H2V7h4V3h2v6zm10 8v4h-2v-6h6v2h-4zM8 15v6H6v-4H2v-2h6z\"\/>\n<\/svg><\/p>\n<\/div>\n<\/div>\n<\/div>\n<p>\u06cc\u0627 \u0645\u06cc \u062a\u0648\u0627\u0646\u06cc\u0645 \u0628\u0627 \u0627\u0633\u062a\u0641\u0627\u062f\u0647 \u0627\u0632 \u0628\u0631\u062e\u06cc \u062f\u06cc\u06af\u0631 \u0627\u0632 \u0645\u0641\u0627\u0647\u06cc\u0645 FP \u0631\u0627\u0647 \u062d\u0644\u06cc \u0628\u06cc\u0646\u062f\u06cc\u0634\u06cc\u0645<\/p>\n<p>` const isWhitespace = [&#8216; &#8216;, &#8216;<br \/>&#8216;, &#8216;    &#8216;].\u0634\u0627\u0645\u0644 \u0645\u06cc \u0634\u0648\u062f<br \/>const isOperator = [&#8216;+&#8217;, &#8216;-&#8216;, &#8216;*&#8217;, &#8220;https:\/\/dev.to\/&#8221;].\u0634\u0627\u0645\u0644 \u0645\u06cc \u0634\u0648\u062f<br \/>&#8230;<\/p>\n<div class=\"highlight js-code-highlight\">\n<pre class=\"highlight plaintext\"><code>const createToken = (type, value) =&gt; ({ type, value })\n\nconst initialState = () =&gt; ({ tokens: [], currentToken: EMPTY_STRING, currentType: null })\n\nconst processChar = (state, char) =&gt; {\n    if (isWhitespace(char)) return finalizeToken(state)\n    if (isOperator(char)) return processOperator(state, char)\n    if (isDigit(char)) return processDigit(state, char)\n    if (isLetter(char)) return processLetter(state, char)\n\n    return state\n}\n\nconst finalizeToken = state =&gt; isEmptyString(currentToken) ? state : ({\n    ...state,\n    tokens: [ ...state.tokens, createToken(state.currentType, state.currentToken) ],\n    currentToken: '',\n    currentType: null\n})\n\nconst processOperator = (state, char) =&gt; ({\n    ...finalizeToken(state),\n    tokens: [...state.tokens, createToken(TYPES.op, char)]\n})\n\nconst processDigit = (state, char) =&gt; ({\n    ...state,\n    currentType: TYPES.Number,\n    currentToken: isNumber(state.currentType) ? state.currentToken + char : char\n})\n\n...\n\nconst tokenize = code =&gt; finalizeToken(code.reduce(processChar, initialState())).tokens\n<\/code><\/pre>\n<div class=\"highlight__panel js-actions-panel\">\n<div class=\"highlight__panel-action js-fullscreen-code-action\">\n    <svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"20px\" height=\"20px\" viewbox=\"0 0 24 24\" class=\"highlight-action crayons-icon highlight-action--fullscreen-on\"><title>\u0648\u0627\u0631\u062f \u062d\u0627\u0644\u062a \u062a\u0645\u0627\u0645 \u0635\u0641\u062d\u0647 \u0634\u0648\u06cc\u062f<\/title>\n    <path d=\"M16 3h6v6h-2V5h-4V3zM2 3h6v2H4v4H2V3zm18 16v-4h2v6h-6v-2h4zM4 19h4v2H2v-6h2v4z\"\/>\n<\/svg><\/p>\n<p>    <svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"20px\" height=\"20px\" viewbox=\"0 0 24 24\" class=\"highlight-action crayons-icon highlight-action--fullscreen-off\"><title>\u0627\u0632 \u062d\u0627\u0644\u062a \u062a\u0645\u0627\u0645 \u0635\u0641\u062d\u0647 \u062e\u0627\u0631\u062c \u0634\u0648\u06cc\u062f<\/title>\n    <path d=\"M18 7h4v2h-6V3h2v4zM8 9H2V7h4V3h2v6zm10 8v4h-2v-6h6v2h-4zM8 15v6H6v-4H2v-2h6z\"\/>\n<\/svg><\/p>\n<\/div>\n<\/div>\n<\/div>\n<p>\u0628\u0627\u0632 \u0647\u0645\u060c \u0645\u0627 \u062f\u0631 \u06a9\u067e\u0633\u0648\u0644\u0627\u0633\u06cc\u0648\u0646\u060c \u0627\u0646\u062a\u0632\u0627\u0639\u0627\u062a \u0648 \u0628\u06cc\u0627\u0646\u06cc \u0628\u0648\u062f\u0646 \u0641\u06a9\u0631 \u0645\u06cc \u06a9\u0646\u06cc\u0645<\/p>\n<p>\u0648 \u0627\u0644\u0628\u062a\u0647\u060c \u0645\u0627 \u0645\u06cc \u062a\u0648\u0627\u0646\u06cc\u0645 \u06cc\u06a9 \u0631\u0627\u0647 \u062d\u0644 \u062a\u0631\u06a9\u06cc\u0628\u06cc \u0627\u0631\u0627\u0626\u0647 \u062f\u0647\u06cc\u0645 \ud83d\ude09<\/p>\n<div class=\"highlight js-code-highlight\">\n<pre class=\"highlight plaintext\"><code>const SPECIAL_CHARS = {\n  SPACE: ' ',\n  NEWLINE: '\n<\/code><\/pre>\n<div class=\"highlight__panel js-actions-panel\">\n<div class=\"highlight__panel-action js-fullscreen-code-action\">\n    <svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"20px\" height=\"20px\" viewbox=\"0 0 24 24\" class=\"highlight-action crayons-icon highlight-action--fullscreen-on\"><title>\u0648\u0627\u0631\u062f \u062d\u0627\u0644\u062a \u062a\u0645\u0627\u0645 \u0635\u0641\u062d\u0647 \u0634\u0648\u06cc\u062f<\/title>\n    <path d=\"M16 3h6v6h-2V5h-4V3zM2 3h6v2H4v4H2V3zm18 16v-4h2v6h-6v-2h4zM4 19h4v2H2v-6h2v4z\"\/>\n<\/svg><\/p>\n<p>    <svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"20px\" height=\"20px\" viewbox=\"0 0 24 24\" class=\"highlight-action crayons-icon highlight-action--fullscreen-off\"><title>\u0627\u0632 \u062d\u0627\u0644\u062a \u062a\u0645\u0627\u0645 \u0635\u0641\u062d\u0647 \u062e\u0627\u0631\u062c \u0634\u0648\u06cc\u062f<\/title>\n    <path d=\"M18 7h4v2h-6V3h2v4zM8 9H2V7h4V3h2v6zm10 8v4h-2v-6h6v2h-4zM8 15v6H6v-4H2v-2h6z\"\/>\n<\/svg><\/p>\n<\/div>\n<\/div>\n<\/div>\n<p>&#8216;\u060c<br \/>TAB: &#8220;&#8221;<br \/>}<\/p>\n<div class=\"highlight js-code-highlight\">\n<pre class=\"highlight plaintext\"><code>const binaryOperation = ['+', '-', '*', \"https:\/\/dev.to\/\"]\n\nclass Tokenizer {\n  constructor(code) {\n    this.code = code\n    this.tokens = []\n    this.currentToken = EMPTY_STRING\n    this.currentType = null\n  }\n\n  tokenize() {\n    this.code.split('').forEach(this.processChar.bind(this))\n    this.finalizeToken()\n    return this.tokens\n  }\n\n  processChar = char =&gt; {\n    const processors = [\n      { predicate: this.isWhitespace, action: this.handleWhitespace },\n      { predicate: this.isOperator, action: this.handleOperator },\n      { predicate: this.isDigit, action: this.handleDigit },\n      { predicate: this.isLetter, action: this.handleLetter }\n    ]\n\n    const { action } = processors.find(({ predicate }) =&gt; predicate(char)) || EMPTY_OBJECT\n    action?.(this, char)\n  }\n\n  isWhitespace = Object.values(SPECIAL_CHARS).includes\n  isOperator = binaryOperation.includes\n  isDigit = \/[0-9]\/.test\n  isLetter = \/[a-zA-Z]\/.test\n  handleWhitespace = this.finalizeToken\n\n  handleOperator = char =&gt; {\n    this.finalizeToken()\n    this.addToken(TYPES.operation, char)\n  }\n\n  handleDigit = char =&gt; {\n    if (!this.isNumber()) { this.finalizeToken(); this.currentType = TYPES.number }\n    this.currentToken += char\n  }\n\n  handleLetter = char =&gt; {\n    if (!this.isIdentifier()) { this.finalizeToken(); this.currentType = TYPES.id }\n    this.currentToken += char\n  }\n\n  finalizeToken() {\n    if (!this.isEmpty()) {\n      this.addToken(this.currentType, this.currentToken)\n      this.currentToken = SPECIAL_CHARS.empty\n      this.currentType = null\n    }\n  }\n\n  addToken(type, value) {\n    this.tokens.push({ type, value })\n  }\n}\n\nconst tokenize = code =&gt; new Tokenizer(code).tokenize()\n<\/code><\/pre>\n<div class=\"highlight__panel js-actions-panel\">\n<div class=\"highlight__panel-action js-fullscreen-code-action\">\n    <svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"20px\" height=\"20px\" viewbox=\"0 0 24 24\" class=\"highlight-action crayons-icon highlight-action--fullscreen-on\"><title>\u0648\u0627\u0631\u062f \u062d\u0627\u0644\u062a \u062a\u0645\u0627\u0645 \u0635\u0641\u062d\u0647 \u0634\u0648\u06cc\u062f<\/title>\n    <path d=\"M16 3h6v6h-2V5h-4V3zM2 3h6v2H4v4H2V3zm18 16v-4h2v6h-6v-2h4zM4 19h4v2H2v-6h2v4z\"\/>\n<\/svg><\/p>\n<p>    <svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"20px\" height=\"20px\" viewbox=\"0 0 24 24\" class=\"highlight-action crayons-icon highlight-action--fullscreen-off\"><title>\u0627\u0632 \u062d\u0627\u0644\u062a \u062a\u0645\u0627\u0645 \u0635\u0641\u062d\u0647 \u062e\u0627\u0631\u062c \u0634\u0648\u06cc\u062f<\/title>\n    <path d=\"M18 7h4v2h-6V3h2v4zM8 9H2V7h4V3h2v6zm10 8v4h-2v-6h6v2h-4zM8 15v6H6v-4H2v-2h6z\"\/>\n<\/svg><\/p>\n<\/div>\n<\/div>\n<\/div>\n<p>`<br \/>\u0627\u062c\u0627\u0632\u0647 \u062f\u0647\u06cc\u062f \u0627\u06cc\u0646 \u0627\u0648\u0644\u06cc\u0646 \u0645\u0642\u0627\u0644\u0647 \u0631\u0627 \u062f\u0631 \u0645\u0648\u0631\u062f \u0637\u0631\u0627\u062d\u06cc \u0646\u0631\u0645 \u0627\u0641\u0632\u0627\u0631 OOP + FP \u0628\u0647 \u067e\u0627\u06cc\u0627\u0646 \u0628\u0631\u0633\u0627\u0646\u06cc\u0645\u060c \u0645\u0646 \u0645\u06cc \u062e\u0648\u0627\u0647\u0645 \u062f\u0631 \u0645\u0648\u0631\u062f \u0627\u06cc\u0646 \u062f\u06cc\u062f\u06af\u0627\u0647 \u0628\u06cc\u0634\u062a\u0631 \u0628\u0646\u0648\u06cc\u0633\u0645 \u0648 \u200b\u200b\u0646\u0645\u0648\u0646\u0647 \u0647\u0627 \u0648 \u0627\u0644\u06af\u0648\u0647\u0627\u06cc \u0628\u0633\u06cc\u0627\u0631 \u067e\u06cc\u0686\u06cc\u062f\u0647 \u062a\u0631 \u0631\u0627 \u0645\u0631\u0648\u0631 \u0645\u06cc \u06a9\u0646\u0645\u060c \u0631\u0627\u0647 \u062d\u0644 \u0647\u0627\u06cc \u0630\u0648\u0628 \u0634\u062f\u0647 \u0631\u0627 \u067e\u06cc\u0634\u0646\u0647\u0627\u062f \u0645\u06cc \u06a9\u0646\u0645 \u0648 \u0627\u06cc\u062f\u0647 \u0647\u0627\u06cc \u0647\u0631 \u062f\u0648 \u067e\u0627\u0631\u0627\u062f\u0627\u06cc\u0645 \u0631\u0627 \u0639\u0645\u06cc\u0642\u0627 \u0628\u0631\u0631\u0633\u06cc \u0645\u06cc \u06a9\u0646\u0645.<\/p>\n<p>\u0627\u06af\u0631 \u0686\u06cc\u0632\u06cc \u0639\u062c\u06cc\u0628 \u0627\u0633\u062a\u060c \u06cc\u0627 \u0627\u06af\u0631 \u0686\u06cc\u0632\u06cc \u062f\u0631 \u0627\u06cc\u0646 \u0645\u0642\u0627\u0644\u0647 \u067e\u06cc\u062f\u0627 \u06a9\u0631\u062f\u06cc\u062f \u06a9\u0647 \u0645\u06cc\u200c\u062a\u0648\u0627\u0646 \u0622\u0646 \u0631\u0627 \u0628\u0647\u0628\u0648\u062f \u0628\u062e\u0634\u06cc\u062f\u060c \u0628\u0647 \u0645\u0646 \u0627\u0637\u0644\u0627\u0639 \u062f\u0647\u06cc\u062f.  \u0645\u0627\u0646\u0646\u062f \u0646\u0631\u0645 \u0627\u0641\u0632\u0627\u0631 \u0645\u0627\u060c \u0627\u06cc\u0646 \u06cc\u06a9 \u0641\u0631\u0622\u06cc\u0646\u062f \u062a\u06a9\u0631\u0627\u0631\u06cc \u0627\u0641\u0632\u0627\u06cc\u0634\u06cc \u0627\u0633\u062a \u06a9\u0647 \u0628\u0627 \u06af\u0630\u0634\u062a \u0632\u0645\u0627\u0646 \u0628\u0647\u0628\u0648\u062f \u0645\u06cc \u06cc\u0627\u0628\u062f.<\/p>\n<p>\u0628\u0627 \u062a\u0634\u06a9\u0631 \u0641\u0631\u0627\u0648\u0627\u0646 \u0628\u0631\u0627\u06cc \u062e\u0648\u0627\u0646\u062f\u0646!<\/p>\n<\/p><\/div>\n","protected":false},"excerpt":{"rendered":"<p>Summarize this content to 400 words in Persian Lang \u0637\u0631\u0627\u062d\u06cc \u0646\u0631\u0645 \u0627\u0641\u0632\u0627\u0631 \u0628\u0627 \u0627\u0633\u062a\u0641\u0627\u062f\u0647 \u0627\u0632 OOP + FP &#8211; \u0642\u0633\u0645\u062a 1 \u0628\u06cc\u0627\u06cc\u06cc\u062f \u0631\u0627\u0647 \u062d\u0644 \u0647\u0627\u06cc \u062f\u06cc\u0648\u0627\u0646\u0647 \u06a9\u0646\u0646\u062f\u0647 \u0627\u06cc \u0631\u0627 \u0628\u0627 \u062a\u0631\u06a9\u06cc\u0628 OOP \u0648 FP \u0627\u0646\u062c\u0627\u0645 \u062f\u0647\u06cc\u0645 \ud83d\ude42 \u0627\u06cc\u062f\u0647 \u0627\u06cc\u0646 \u0645\u0642\u0627\u0644\u0647 \u0627\u06cc\u0646 \u0627\u0633\u062a \u06a9\u0647 \u0686\u0646\u062f\u06cc\u0646 \u0627\u0644\u06af\u0648 \u0631\u0627 \u062e\u0644\u0627\u0635\u0647 \u06a9\u0646\u062f \u0648 \u0645\u062b\u0627\u0644 \u0647\u0627\u06cc\u06cc \u0627\u0632 \u0646\u062d\u0648\u0647 \u062d\u0644 \u0645\u0648\u0627\u0631\u062f &hellip;<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"fifu_image_url":"","fifu_image_alt":"","footnotes":""},"categories":[339],"tags":[],"class_list":["post-67605","post","type-post","status-publish","format-standard","hentry","category-dev"],"_links":{"self":[{"href":"https:\/\/nabfollower.com\/blog\/wp-json\/wp\/v2\/posts\/67605","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/nabfollower.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/nabfollower.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/nabfollower.com\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/nabfollower.com\/blog\/wp-json\/wp\/v2\/comments?post=67605"}],"version-history":[{"count":0,"href":"https:\/\/nabfollower.com\/blog\/wp-json\/wp\/v2\/posts\/67605\/revisions"}],"wp:attachment":[{"href":"https:\/\/nabfollower.com\/blog\/wp-json\/wp\/v2\/media?parent=67605"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/nabfollower.com\/blog\/wp-json\/wp\/v2\/categories?post=67605"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/nabfollower.com\/blog\/wp-json\/wp\/v2\/tags?post=67605"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}