{"id":7622,"date":"2022-02-14T17:01:34","date_gmt":"2022-02-14T11:31:34","guid":{"rendered":"https:\/\/selfimagination.in\/tips\/?p=7622"},"modified":"2022-07-19T15:53:30","modified_gmt":"2022-07-19T10:23:30","slug":"self-invoking-function","status":"publish","type":"post","link":"https:\/\/selfimagination.in\/tips\/self-invoking-function\/","title":{"rendered":"Self Invoking Function"},"content":{"rendered":"\n<p>\u0905\u0928\u094d\u092f Function \u0915\u0940 \u0924\u0930\u0939 \u092f\u0939 \u092d\u0940 \u090f\u0915 Function \u0939\u0948\u0902 \u0938\u093e\u0925 \u092e\u0947 \u0907\u0938\u092e\u0947 \u090f\u0915 \u0935\u093f\u0936\u0947\u0937 \u0917\u0941\u0923 \u0939\u0948\u0902 \u0915\u0940 \u092f\u0939 function Define \u0939\u094b\u0924\u0947 \u0939\u0940 \u0916\u0941\u0926 \u0915\u094b Call \u0915\u0930 \u0932\u0947\u0924\u093e \u0939\u0948\u0902 \u0964 \u0907\u0938\u0932\u093f\u090f \u0939\u0940 \u0907\u0938\u0947 Self Invoking Function \u0915\u0939\u093e \u091c\u093e\u0924\u093e \u0939\u0948\u0902 \u0964 \u0916\u0941\u0926 \u0915\u094b Call \u0915\u0930\u0928\u0947 \u0915\u0947 \u0915\u093e\u0930\u0923 \u0907\u0938\u0947 Self Calling  Function \u092d\u0940 \u0915\u0939\u093e \u091c\u093e\u0924\u093e \u0939\u0948\u0902 \u0964 <\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"\u0938-\u0932-\u092b-\u0907\u0928-\u0935-\u0915-\u0917-\u092b-\u0915-\u0936\u0928-\u0915-\u092f-\u0939\">\u0938\u0947\u0932\u094d\u092b \u0907\u0928\u094d\u0935\u094b\u0915\u093f\u0902\u0917 \u092b\u0902\u0915\u094d\u0936\u0928 \u0915\u094d\u092f\u093e \u0939\u0948?<\/h2>\n\n\n\n<ul class=\"wp-block-list\"><li>\u092f\u0939 \u090f\u0915 Anonyms Function \u0915\u0940 \u0924\u0930\u0939 \u0939\u0948\u0902 \u091c\u093f\u0938\u0915\u093e \u0915\u094b\u0908 \u0928\u093e\u092e \u0928\u0939\u0940\u0902 (Nameless Function) \u0939\u094b\u0924\u093e \u0939\u0948\u0902\u0964 <\/li><li>\u092f\u0939 Define \u0939\u094b\u0924\u0947 \u0939\u0940 \u0938\u094d\u0935\u092f\u0902 \u0915\u094b Call (Invoking) \u0915\u0930 \u0932\u0947\u0924\u093e \u0939\u0948\u0902 \u0964 <\/li><\/ul>\n\n\n\n<p> <\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"benefit-of-self-invoking-function-\u0915-\u092b-\u092f\u0926\">Benefit of Self Invoking Function \u0915\u0947 \u092b\u093e\u092f\u0926\u0947   <\/h2>\n\n\n\n<ul class=\"wp-block-list\"><li>\u091c\u092c \u092d\u0940 \u0939\u092e \u0915\u094b\u0908 \u0928\u092f\u093e function \u092c\u0928\u093e\u0924\u0947 \u0939\u0948\u0902 \u0924\u094b \u0938\u092c\u0938\u0947 \u092a\u0939\u0932\u0947 \u0939\u092e\u0947 function \u0915\u093e \u090f\u0915 unique \u0928\u093e\u092e \u0930\u0916\u0928\u093e \u0939\u094b\u0924\u093e \u0939\u0948\u0902 \u092f\u0926\u093f \u0939\u092e\u0928\u0947 unique \u0928\u093e\u092e \u0930\u0939\u0940 \u0930\u0916\u093e \u0924\u094b function duplicate \u092c\u0928 \u091c\u093e\u0924\u0947 \u0939\u0948\u0902, \u0938\u0947\u0932\u094d\u092b \u0907\u0928\u094d\u0935\u094b\u0915\u093f\u0902\u0917 \u092b\u0902\u0915\u094d\u0936\u0928 \u0915\u094b \u091c\u092c \u0921\u093f\u092b\u093e\u0907\u0928 \u0915\u093f\u092f\u093e \u091c\u093e\u0924\u093e \u0939\u0948\u0902 \u0924\u092c \u0928\u093e\u092e \u0930\u0916\u0928\u0947 \u0915\u0940 \u0906\u0935\u0936\u094d\u092f\u0915\u0924\u093e \u0928\u0939\u0940\u0902 \u0939\u094b\u0924\u0940 \u0939\u0948\u0902 \u0909\u0938\u0938\u0947 Duplicity \u0915\u093e \u0915\u094b\u0908 \u0907\u0936\u0942 \u0928\u0939\u0940\u0902 \u0939\u094b\u0924\u093e \u0939\u0948\u0902 \u0964<\/li><li>\u0939\u092e Self Invocation Function \u0915\u0947 \u0938\u094d\u0925\u093e\u0928 \u092a\u0930 \u0915\u094b\u0908 Normal Function \u092c\u0928\u093e \u0915\u0930 \u0909\u0938\u0947 \u092d\u0940 Call \u0915\u0930 \u0938\u0915\u0924\u0947 \u0939\u0948\u0902 \u0932\u0947\u0915\u093f\u0928 Normal Function \u092e\u0947 function \u0915\u093e \u0928\u093e\u092e \u0930\u0916\u0928\u0947 \u0914\u0930 use call \u0915\u0930\u0924\u0947 \u0938\u092e\u092f \u092b\u093f\u0930 \u0938\u0947 \u0928\u093e\u092e \u0932\u093f\u0916\u0928\u0947 \u092e\u0947 Code \u0915\u093e size \u092c\u095d\u0924\u093e \u0939\u0948\u0902, \u0907\u0938\u0915\u0947 \u0938\u094d\u0925\u093e\u0928 \u092a\u0930 \u092f\u0926\u093f \u0939\u092e Self Invoking Function \u0915\u093e \u0909\u092a\u092f\u094b\u0917 \u0915\u0930\u0947\u0902\u0917\u0947 \u0924\u094b \u0939\u092e\u0947 Code \u0915\u094b Minimize \u0915\u0930\u0928\u0947 \u0915\u0940 \u091c\u0930\u0942\u0930\u0924 \u0928\u0939\u0940\u0902 \u0939\u094b\u0924\u0940 \u0939\u0948\u0902 \u0964 <\/li><\/ul>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"self-invoking-function-for-security\">Self Invoking Function for Security <\/h2>\n\n\n\n<p>\u0938\u0947\u0932\u094d\u092b \u0907\u0928\u094d\u0935\u094b\u0915\u093f\u0902\u0917 \u092b\u0902\u0915\u094d\u0936\u0928 \u0915\u093e \u0909\u092a\u092f\u094b\u0917 \u0915\u0930\u0928\u0947 \u0938\u0947 \u0939\u092e\u0947 Global Variable \u0915\u0947 \u0909\u092a\u092f\u094b\u0917 \u0915\u094b \u0915\u092e \u0915\u0930 \u0938\u0915\u0924\u0947 \u0939\u0948\u0902 , \u092f\u0926\u093f Global Variable \u0915\u092e Declare \u0915\u093f\u090f \u091c\u093e\u090f\u0902\u0917\u0947 \u0924\u094b \u0939\u092e\u093e\u0930\u0947 Program \u0905\u0927\u093f\u0915 Secure \u0939\u094b\u0902\u0917\u0947 \u0964 <\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"what-is-iife-\u0915-\u092f-\u0939\">What is IIFE \u0915\u094d\u092f\u093e \u0939\u0948\u0902?<\/h2>\n\n\n\n<p>IIFE \u0915\u093e \u092a\u0942\u0930\u093e \u0928\u093e\u092e <strong>Immediately Invoked Function Expression<\/strong> \u0939\u0948\u0902 \u091c\u0948\u0938\u093e \u0915\u0940 \u0928\u093e\u092e \u0938\u0947 \u0939\u0940 \u0938\u092e\u091d \u092e\u0947 \u0906 \u0930\u0939\u093e \u0939\u0948\u0902 \u0915\u0940 \u092f\u0939 define \u0939\u094b\u0924\u0947 \u0939\u0940 Execute \u0939\u094b \u091c\u093e\u0924\u0947 \u0939\u0948\u0902 \u0907\u0928\u094d\u0939\u0947 \u0939\u0940 Self Invoking Function \u0915\u0939\u093e \u091c\u093e\u0924\u093e \u0939\u0948\u0902\u0964 \u092f\u0939 \u0924\u0940\u0928 \u0924\u0930\u0939 \u0938\u0947 \u0932\u093f\u0916 \u0938\u0915\u0924\u0947 \u0939\u0948\u0902 <\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>Simple IIFE<\/li><li>Arrow Function IIFE<\/li><li>async Function IIFE<\/li><\/ul>\n\n\n\n<p><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"javascript\" class=\"language-javascript\">\/*Simple IIFE*\/\n(function () {\n  \/* Body of Function *\/\n})();\n\n\n\/*Arrow Function IIFE*\/\n(() =&gt; {\n  \/* Body of Function *\/\n})();\n\n\n\/*async Function IIFE*\/\n(async () =&gt; {\n  \/* Body of Function *\/\n})();\n<\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator has-css-opacity\"\/>\n\n\n\n<p><\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"self-invoking-function-with-example-in-hindi\">Self Invoking Function with Example in hindi <\/h2>\n\n\n\n<p>Q : Self Invoking Function kya hai udaharan dwara samjhaie. <\/p>\n\n\n\n<p>\u0906\u0907\u090f \u0905\u092c \u0939\u092e Self Invoking Function \u0915\u094b \u0909\u0926\u093e\u0939\u0930\u0923 \u0926\u094d\u0935\u093e\u0930\u093e \u0938\u092e\u091d\u0924\u0947 \u0939\u0948\u0902 \u0964 \u0907\u0938 Example \u092e\u0947 \u0939\u092e\u0928\u0947 JavaScript \u092e\u0947 \u090f\u0915 Program \u092c\u0928\u093e\u092f\u093e \u0939\u0948\u0902 \u0964 <\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"javascript\" class=\"language-javascript\">&lt;html&gt;\n\t&lt;head&gt;&lt;title&gt;Self Invoking Function Example&lt;\/title&gt;\n\t\t&lt;script&gt;\n\t\t(function () {\n\t\t  let MyVar  = \"Welcome\";  \n\t\t  alert (MyVar);\n\t\t})();\n\t&lt;\/script&gt;\n\t&lt;\/head&gt;\n\t&lt;body&gt;\n\t\n\t&lt;\/body&gt;\n&lt;\/html&gt;<\/code><\/pre>\n\n\n\n<p>\u091c\u092c \u0906\u092a \u0907\u0938 Code \u0915\u094b Execute \u0915\u0930 \u0926\u0947\u0916\u0947\u0902\u0917\u0947 \u0924\u094b \u092a\u093e\u090f\u0902\u0917\u0947 \u0915\u0940 Page open \u0939\u094b\u0924\u0947 \u0939\u0940 Alert \u092e\u0947 Welcome \u0932\u093f\u0916\u093e \u0939\u0941\u0906 \u0906\u090f\u0917\u093e \u0964 \u092f\u093e\u0928\u093f \u0915\u0940 Function define \u0939\u094b\u0928\u0947 \u0915\u0947 \u092c\u093e\u0926 \u0916\u0941\u0926 \u0939\u0940 Call \u0939\u094b \u0917\u092f\u093e \u0939\u0948\u0902 \u0964 <\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"456\" height=\"136\" src=\"https:\/\/i0.wp.com\/selfimagination.in\/tips\/wp-content\/uploads\/2022\/02\/image-35.png?resize=456%2C136&#038;ssl=1\" alt=\"Self Invoking Function Example \" class=\"wp-image-7636\" srcset=\"https:\/\/i0.wp.com\/selfimagination.in\/tips\/wp-content\/uploads\/2022\/02\/image-35.png?w=456&amp;ssl=1 456w, https:\/\/i0.wp.com\/selfimagination.in\/tips\/wp-content\/uploads\/2022\/02\/image-35.png?resize=300%2C89&amp;ssl=1 300w\" sizes=\"auto, (max-width: 456px) 100vw, 456px\" \/><\/figure>\n<\/div>\n\n\n<ul class=\"wp-block-list\"><li><strong>function () :<\/strong> \u0907\u0938 Function \u0915\u093e \u0915\u094b\u0908 \u0928\u093e\u092e \u0928\u0939\u0940\u0902 \u0939\u0948\u0902 \u0915\u0947\u0935\u0932 Function \u0932\u093f\u0916\u093e \u0939\u0948\u0902 \u0914\u0930 \u0909\u0938\u0915\u0947 \u092c\u093e\u0926 () \u092c\u094d\u0930\u0947\u0915\u0947\u091f \u0932\u0917\u0947 \u0939\u0948 \u0964 <\/li><li><strong>( function () { body }) :<\/strong> Body \u0915\u0947 \u0938\u094d\u0925\u093e\u0928 \u092a\u0930 \u0906\u092a \u091c\u094b \u092d\u0940 Code \u0932\u093f\u0916\u0928\u093e \u091a\u093e\u0939\u0947 \u0935\u0939 \u0932\u093f\u0916 \u0938\u0915\u0924\u0947 \u0939\u0948\u0902 \u0964 <\/li><li><strong>(); : <\/strong>Last \u092e\u0947 (); \u092f\u0939 Function \u0915\u094b Call \u0915\u0930\u0924\u093e \u0939\u0948\u0902 \u0964 <\/li><\/ul>\n\n\n\n<hr class=\"wp-block-separator has-css-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"self-invoking-function-parameter-example\">Self Invoking Function Parameter Example <\/h2>\n\n\n\n<p>Q : \u0938\u0947\u0932\u094d\u092b \u0907\u0928\u094d\u0935\u094b\u0915\u093f\u0902\u0917 \u092b\u0902\u0915\u094d\u0936\u0928 \u0915\u094d\u092f\u093e \u0939\u0948 \u0909\u0926\u093e\u0939\u0930\u0923 \u0926\u094d\u0935\u093e\u0930\u093e \u0938\u092e\u091d\u093e\u0907\u090f<\/p>\n\n\n\n<p>\u0906\u092a \u0938\u0947\u0932\u094d\u092b \u0907\u0928\u094d\u0935\u094b\u0915\u093f\u0902\u0917 \u092b\u0902\u0915\u094d\u0936\u0928 \u092e\u0947 \u092a\u0947\u0930\u093e\u092e\u0940\u091f\u0930 \u092d\u0940 Pass \u0915\u0930 \u0938\u0915\u0924\u0947 \u0939\u0948\u0902\u0964 \u0928\u093f\u092e\u094d\u0928 Example \u092e\u0947 \u0939\u092e\u0928\u0947 Last (); \u092c\u094d\u0930\u0947\u0915\u0947\u091f \u092e\u0947 Value of Parameter \u092a\u093e\u0938 \u0915\u093f\u092f\u093e \u0939\u0948\u0902 \u091c\u094b \u0915\u0940 \u0939\u092e\u0947 Alert \u0915\u0947 \u092e\u093e\u0927\u094d\u092f\u092e \u0938\u0947 \u0926\u093f\u0916\u093e\u0908 \u0926\u0947\u0917\u0940 \u0964  <\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"javascript\" class=\"language-javascript\">(function(MyParam){\n alert(MyParam);\n})(\"Value of Parameter\");<\/code><\/pre>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"455\" height=\"140\" src=\"https:\/\/i0.wp.com\/selfimagination.in\/tips\/wp-content\/uploads\/2022\/02\/image-36.png?resize=455%2C140&#038;ssl=1\" alt=\"Self Invoking Function Parameter Example \" class=\"wp-image-7637\" srcset=\"https:\/\/i0.wp.com\/selfimagination.in\/tips\/wp-content\/uploads\/2022\/02\/image-36.png?w=455&amp;ssl=1 455w, https:\/\/i0.wp.com\/selfimagination.in\/tips\/wp-content\/uploads\/2022\/02\/image-36.png?resize=300%2C92&amp;ssl=1 300w\" sizes=\"auto, (max-width: 455px) 100vw, 455px\" \/><\/figure>\n<\/div>\n\n\n<hr class=\"wp-block-separator has-css-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"self-invoking-function-with-global-window-object\">Self Invoking Function With Global window Object .<\/h2>\n\n\n\n<p>Q : Self Invoking Function kya hai udaharan dwara samjhaye \u0964 <\/p>\n\n\n\n<p>\u0928\u093f\u092e\u094d\u0928 Example \u092e\u0947 \u0939\u092e\u0928\u0947 function \u0915\u0940 value \u0915\u094b Global Variable Object \u0915\u0947 \u0926\u094d\u0935\u093e\u0930\u093e \u0909\u092a\u092f\u094b\u0917 \u0915\u093f\u092f\u093e \u0939\u0948\u0902 \u0964 \u0928\u093f\u092e\u094d\u0928 function \u092e\u0947 \u0939\u092e\u0928\u0947 \u090f\u0915 MyFunction \u0915\u0947 \u0928\u093e\u092e \u0938\u0947 \u090f\u0915 function \u092c\u0928\u093e\u092f\u093e \u0939\u0948\u0902 \u091c\u094b \u0915\u0940 Hello Return \u0915\u0930\u0947\u0917\u093e \u091c\u093f\u0938\u0915\u094b \u0915\u0940 \u0939\u092e\u0928\u0947 window.MyFn Variable \u092e\u0947 Store \u0915\u093f\u092f\u093e \u0939\u0948\u0902 \u0905\u092c \u0939\u092e \u0907\u0938\u0947 Globally \u0909\u092a\u092f\u094b\u0917 \u0915\u0930 \u0938\u0915\u0924\u0947 \u0939\u0948\u0902 \u091c\u094b \u0915\u0940 \u0939\u092e\u0928\u0947 Alert \u092e\u0947 MyFn() \u0915\u094b \u0926\u093f\u0916\u093e\u092f\u093e \u0917\u092f\u093e \u0939\u0948\u0902 \u0964 <\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"javascript\" class=\"language-javascript\">\/* Global Window Object *\/\n\t(function(){\n\t\t\n\t\tfunction MyFunction() {\n\t\t\treturn \"Hello\";\n\t\t}\n\t\twindow.MyFn = MyFunction;\n\t})(window);\n\t\n\talert(MyFn());\t<\/code><\/pre>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"457\" height=\"138\" src=\"https:\/\/i0.wp.com\/selfimagination.in\/tips\/wp-content\/uploads\/2022\/02\/image-37.png?resize=457%2C138&#038;ssl=1\" alt=\"Self Invoking Global Window Function \" class=\"wp-image-7643\" srcset=\"https:\/\/i0.wp.com\/selfimagination.in\/tips\/wp-content\/uploads\/2022\/02\/image-37.png?w=457&amp;ssl=1 457w, https:\/\/i0.wp.com\/selfimagination.in\/tips\/wp-content\/uploads\/2022\/02\/image-37.png?resize=300%2C91&amp;ssl=1 300w\" sizes=\"auto, (max-width: 457px) 100vw, 457px\" \/><\/figure>\n<\/div>\n\n\n<hr class=\"wp-block-separator has-css-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"\u0939\u092e-\u0930-\u0905\u0928-\u092f-\u0906\u0930-\u091f-\u0915\u0932\"><strong>\u0939\u092e\u093e\u0930\u0947 \u0905\u0928\u094d\u092f \u0906\u0930\u094d\u091f\u093f\u0915\u0932<\/strong><\/h2>\n\n\n\n<ul class=\"wp-block-list\"><li><a href=\"https:\/\/selfimagination.in\/tips\/mysql-function\/\">MySQL Function<\/a><\/li><li><a href=\"https:\/\/selfimagination.in\/tips\/mysql-stored-procedure\/\">MySQL Stored Procedure<\/a><\/li><li><a href=\"https:\/\/selfimagination.in\/tips\/get-post-method\/\">PHP Get \/Post Method \u0915\u0947 \u092c\u093e\u0930\u0947 \u092e\u0947\u0902 \u091c\u093e\u0928\u0947<\/a><\/li><li><a href=\"https:\/\/selfimagination.in\/tips\/php-math-function\/\">PHP Math Function \u0915\u0947 \u092c\u093e\u0930\u0947 \u092e\u0947\u0902 \u091c\u093e\u0928\u0947<\/a><\/li><li><a href=\"https:\/\/selfimagination.in\/tips\/learn-cpp-from-c\/\">C \u0938\u0947 C ++ \u0938\u0940\u0916\u0947 \u0938\u0930\u0932 \u0936\u092c\u094d\u0926\u094b\u0902 \u092e\u0947\u0902<\/a><\/li><li><a href=\"https:\/\/selfimagination.in\/tips\/php-variables\/\">PHP Variable \u0915\u0947 \u092c\u093e\u0930\u0947 \u092e\u0947\u0902 \u091c\u093e\u0928\u0947<\/a><\/li><li><a href=\"https:\/\/selfimagination.in\/tips\/arduino-control-structure\/\">Arduino Control Structure<\/a>\u00a0<\/li><li><a href=\"https:\/\/selfimagination.in\/tips\/c-union\/\">Union in C<\/a><\/li><li><a href=\"https:\/\/selfimagination.in\/tips\/c-pointer\/\">Declaration of Pointer in C<\/a><\/li><li><a href=\"https:\/\/selfimagination.in\/tips\/search-jquery\/\">jQuery Search Filter<\/a><\/li><li><a href=\"https:\/\/selfimagination.in\/tips\/mysql-table-create-alter-drop\/\">MySQL Create Table | Alter Table | Drop Table<\/a><\/li><li><a href=\"https:\/\/selfimagination.in\/tips\/api-using-node-react-express-mysql\/\">API Using NODE REACT EXPRESS MYSQL SEQUELIZE (For Backend OR Server Side)<\/a><\/li><li><a href=\"https:\/\/selfimagination.in\/tips\/cpanel\/\">CPANEL In Hindi<\/a><\/li><\/ul>\n\n\n\n<hr class=\"wp-block-separator has-css-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"self-invoking-function-with-global-window-variable\">Self Invoking Function With Global window Variable <\/h2>\n\n\n\n<p>Q : \u0938\u0947\u0932\u094d\u092b \u0907\u0928\u094d\u0935\u094b\u0915\u093f\u0902\u0917 \u092b\u0902\u0915\u094d\u0936\u0928 \u0909\u0926\u093e\u0939\u0930\u0923 \u0938\u0939\u093f\u0924 \u0938\u092e\u091d\u093e\u090f \u0964 <\/p>\n\n\n\n<p>\u0928\u093f\u092e\u094d\u0928 Example \u092e\u0947 \u0939\u092e\u0928\u0947 window global \u0915\u093e \u0909\u092a\u092f\u094b\u0917 \u0915\u0930 <strong>window.MyVar<\/strong> \u092e\u0947 My Variable \u0915\u0940 Value \u0915\u094b Set \u0915\u093f\u092f\u093e \u0939\u0948 , \u0914\u0930 Function \u0915\u0947 \u092c\u093e\u0939\u0930 \u0938\u0947 \u0939\u092e\u0928\u0947 \u0915\u0947\u0935\u0932 MyVar \u0915\u094b Alert \u0915\u093f\u092f\u093e \u0939\u0948\u0902 \u0910\u0938\u093e \u0915\u0930\u0928\u0947 \u0938\u0947 \u091c\u094b <strong>123<\/strong> \u0935\u0948\u0932\u094d\u092f\u0942 Function \u092e\u0947 Set \u0915\u0940 \u0925\u0940 \u0909\u0938\u0947 \u0939\u092e\u0928\u0947 \u092c\u093e\u0939\u0930 \u0938\u0947 \u0909\u092a\u092f\u094b\u0917 \u0915\u0940 \u0939\u0948\u0902 , \u0907\u0938 \u0938\u0947 \u092f\u0939 Prove \u0939\u094b\u0924\u093e \u0939\u0948\u0902 \u0939\u092e self invoking function \u0915\u093e \u0909\u092a\u092f\u094b\u0917 \u0915\u0930 \u0939\u092e\u093e\u0930\u0947 Inner Variable \u0915\u094b Secure \u0915\u0930 \u0938\u0915\u0924\u0947 \u0939\u0948\u0902 \u0964  <\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"javascript\" class=\"language-javascript\">\/* Global Window Variable  *\/\n\t(function(){\n\t\tvar My = 123; \n\t\twindow.MyVar = My;\n\t})(window);\n\t\n\talert(MyVar);\t<\/code><\/pre>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"455\" height=\"140\" src=\"https:\/\/i0.wp.com\/selfimagination.in\/tips\/wp-content\/uploads\/2022\/02\/image-38.png?resize=455%2C140&#038;ssl=1\" alt=\"\" class=\"wp-image-7646\" srcset=\"https:\/\/i0.wp.com\/selfimagination.in\/tips\/wp-content\/uploads\/2022\/02\/image-38.png?w=455&amp;ssl=1 455w, https:\/\/i0.wp.com\/selfimagination.in\/tips\/wp-content\/uploads\/2022\/02\/image-38.png?resize=300%2C92&amp;ssl=1 300w\" sizes=\"auto, (max-width: 455px) 100vw, 455px\" \/><\/figure>\n<\/div>\n\n\n<hr class=\"wp-block-separator has-css-opacity\"\/>\n\n\n\n<p><br>\u0906\u0936\u093e \u0939\u0948\u0902 \u092e\u0941\u091d\u0947 \u0915\u0940 \u0906\u092a\u0915\u094b \u092f\u0939 Article \u092c\u0939\u0941\u0924 \u0939\u0940 \u0905\u091a\u094d\u091b\u0947 \u0938\u0947 \u0938\u092e\u091d \u092e\u0947 \u092f\u093e \u0917\u092f\u093e \u0939\u094b\u0917\u093e \u092b\u093f\u0930 \u092d\u0940 \u092f\u0926\u093f \u0906\u092a\u0915\u0947 \u0915\u094b\u0908 doubt \u0939\u094b \u0924\u094b \u0906\u092a \u092e\u0941\u091d\u0947 \u0928\u093f\u0938\u0902\u0915\u094b\u091a Comment \u0915\u0930 \u0938\u0915\u0924\u0947 \u0939\u0948\u0902 \u0964 <\/p>\n\n\n\n<p>\u092f\u0939 \u0906\u0930\u094d\u091f\u093f\u0915\u0932 \u0906\u092a\u0915\u094b \u0915\u0948\u0938\u093e \u0932\u0917\u093e \u0939\u092e\u0947 \u091c\u0930\u0942\u0930 \u092c\u0924\u093e\u090f, \u0905\u092a\u0928\u093e \u0915\u0940\u092e\u0924\u0940 \u0938\u092e\u092f \u0926\u0947\u0928\u0947 \u0915\u0947 \u0932\u093f\u090f \u0927\u0928\u094d\u092f\u0935\u093e\u0926 \u0964 <\/p>\n\n\n\n<hr class=\"wp-block-separator has-css-opacity\"\/>\n","protected":false},"excerpt":{"rendered":"<p>\u0905\u0928\u094d\u092f Function \u0915\u0940 \u0924\u0930\u0939 \u092f\u0939 \u092d\u0940 \u090f\u0915 Function \u0939\u0948\u0902 \u0938\u093e\u0925 \u092e\u0947 \u0907\u0938\u092e\u0947 \u090f\u0915 \u0935\u093f\u0936\u0947\u0937 \u0917\u0941\u0923 \u0939\u0948\u0902 \u0915\u0940 \u092f\u0939 function Define \u0939\u094b\u0924\u0947 \u0939\u0940 \u0916\u0941\u0926 \u0915\u094b Call \u0915\u0930 \u0932\u0947\u0924\u093e \u0939\u0948\u0902 \u0964 \u0907\u0938\u0932\u093f\u090f \u0939\u0940 \u0907\u0938\u0947 Self Invoking Function \u0915\u0939\u093e \u091c\u093e\u0924\u093e \u0939\u0948\u0902 \u0964 \u0916\u0941\u0926 \u0915\u094b Call \u0915\u0930\u0928\u0947 \u0915\u0947 \u0915\u093e\u0930\u0923 \u0907\u0938\u0947 Self Calling Function \u092d\u0940 \u0915\u0939\u093e \u091c\u093e\u0924\u093e \u0939\u0948\u0902 \u0964 \u0938\u0947\u0932\u094d\u092b [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":7668,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[12],"tags":[],"class_list":["post-7622","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-javascript"],"jetpack_sharing_enabled":true,"jetpack_featured_media_url":"https:\/\/i0.wp.com\/selfimagination.in\/tips\/wp-content\/uploads\/2022\/02\/self-invoking-function-js.jpg?fit=1200%2C628&ssl=1","_links":{"self":[{"href":"https:\/\/selfimagination.in\/tips\/wp-json\/wp\/v2\/posts\/7622","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/selfimagination.in\/tips\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/selfimagination.in\/tips\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/selfimagination.in\/tips\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/selfimagination.in\/tips\/wp-json\/wp\/v2\/comments?post=7622"}],"version-history":[{"count":43,"href":"https:\/\/selfimagination.in\/tips\/wp-json\/wp\/v2\/posts\/7622\/revisions"}],"predecessor-version":[{"id":8723,"href":"https:\/\/selfimagination.in\/tips\/wp-json\/wp\/v2\/posts\/7622\/revisions\/8723"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/selfimagination.in\/tips\/wp-json\/wp\/v2\/media\/7668"}],"wp:attachment":[{"href":"https:\/\/selfimagination.in\/tips\/wp-json\/wp\/v2\/media?parent=7622"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/selfimagination.in\/tips\/wp-json\/wp\/v2\/categories?post=7622"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/selfimagination.in\/tips\/wp-json\/wp\/v2\/tags?post=7622"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}