{"id":20195,"date":"2021-09-27T16:43:03","date_gmt":"2021-09-27T11:13:03","guid":{"rendered":"https:\/\/tutorial.eyehunts.com\/?p=20195"},"modified":"2022-08-08T18:18:18","modified_gmt":"2022-08-08T12:48:18","slug":"python-static-variable-in-a-function-example-code","status":"publish","type":"post","link":"https:\/\/tutorial.eyehunts.com\/python\/python-static-variable-in-a-function-example-code\/","title":{"rendered":"Python static variable in a function | Example code"},"content":{"rendered":"\n<p>You can make static variables inside a function in many ways in Python. If declaring a static variable in a function means variable throughout the lifetime of the program.<\/p>\n\n\n\n<div style=\"height:30px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Python static variable in a function examples<\/strong><\/h2>\n\n\n\n<p>Simple 3 example code for it:-<\/p>\n\n\n\n<div style=\"height:30px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Add attributes to a function<\/strong><\/h3>\n\n\n\n<p>You can add attributes to a function, and use it as a static variable. Count how many times functions have been called using a static variable.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>def foo():\n    foo.counter += 1\n    print(\"Counter is %d\" % foo.counter)\n\n\nfoo.counter = 0\n\nfoo()\nfoo()<\/code><\/pre>\n\n\n\n<p><strong>Output<\/strong>:<\/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=\"288\" height=\"136\" src=\"https:\/\/i0.wp.com\/tutorial.eyehunts.com\/wp-content\/uploads\/2021\/09\/Python-static-variable-in-a-function.jpg?resize=288%2C136&#038;ssl=1\" alt=\"Python static variable in a function\" class=\"wp-image-20404\"\/><\/figure><\/div>\n\n\n<div style=\"height:30px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Initialization code at the top using decorator<\/strong> <\/h3>\n\n\n\n<p>If you want the counter initialization code at the top instead of the bottom, you can create a <a href=\"https:\/\/tutorial.eyehunts.com\/python\/python-static-method-staticmethod-decorator-example\/\">decorator<\/a>:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>def static_vars(**kwargs):\n    def decorate(func):\n        for k in kwargs:\n            setattr(func, k, kwargs&#91;k])\n        return func\n\n    return decorate\n\n\n# Then use the code like this:\n@static_vars(counter=0)\ndef foo():\n    foo.counter += 1\n    print(\"Counter is %d\" % foo.counter)\n\n\nfoo()<\/code><\/pre>\n\n\n\n<p><strong>Output<\/strong>: Counter is 1<\/p>\n\n\n\n<div style=\"height:30px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Use hasattr()<\/strong><\/h3>\n\n\n\n<p>Alternatively, if you don&#8217;t want to set up the variable outside the function, you can use <strong>hasattr<\/strong>() to avoid an AttributeError <a href=\"https:\/\/tutorial.eyehunts.com\/python\/python-exception-handling-error-handling\/\">exception<\/a>:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>def myfunc():\n    if not hasattr(myfunc, \"counter\"):\n        myfunc.counter = 0  # it doesn't exist yet, so initialize it\n    myfunc.counter += 1\n    return myfunc.counter\n\nprint(myfunc())\nprint(myfunc())<\/code><\/pre>\n\n\n\n<p><strong>Output<\/strong>:<\/p>\n\n\n\n<p>1<br>2<\/p>\n\n\n\n<div style=\"height:30px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<p>Do comment if you have any doubts or suggestions on this Python variable topic.<\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\"><p><strong>Note:<\/strong> IDE:&nbsp;<a rel=\"noreferrer noopener\" href=\"https:\/\/www.jetbrains.com\/pycharm\/\" target=\"_blank\">PyCharm<\/a>&nbsp;2021.3.3 (Community Edition)<\/p><p>Windows 10<\/p><p><strong>Python 3.10.1<\/strong><\/p><p>All<strong>&nbsp;Python Examples&nbsp;are in&nbsp;Python&nbsp;3<\/strong>, so Maybe its different from python 2 or upgraded versions.<\/p><\/blockquote>\n","protected":false},"excerpt":{"rendered":"<p>You can make static variables inside a function in many ways in Python. If declaring a static variable in a function means variable throughout the lifetime of the program. Python static variable in a function examples Simple 3 example code for it:- Add attributes to a function You can add attributes to a function, and&hellip;&nbsp;<a href=\"https:\/\/tutorial.eyehunts.com\/python\/python-static-variable-in-a-function-example-code\/\" rel=\"bookmark\">Read More &raquo;<span class=\"screen-reader-text\">Python static variable in a function | Example code<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"neve_meta_sidebar":"","neve_meta_container":"","neve_meta_enable_content_width":"","neve_meta_content_width":0,"neve_meta_title_alignment":"","neve_meta_author_avatar":"","neve_post_elements_order":"","neve_meta_disable_header":"","neve_meta_disable_footer":"","neve_meta_disable_title":"","jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[30],"tags":[213,32],"post_series":[],"class_list":["post-20195","post","type-post","status-publish","format-standard","hentry","category-python","tag-python-static","tag-python-variables"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.1.1 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Python static variable in a function | Example code<\/title>\n<meta name=\"description\" content=\"You can make static variables inside a function in many ways in Python. If declaring a static variable in a function means variable throug...\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/tutorial.eyehunts.com\/python\/python-static-variable-in-a-function-example-code\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Python static variable in a function | Example code\" \/>\n<meta property=\"og:description\" content=\"You can make static variables inside a function in many ways in Python. If declaring a static variable in a function means variable throug...\" \/>\n<meta property=\"og:url\" content=\"https:\/\/tutorial.eyehunts.com\/python\/python-static-variable-in-a-function-example-code\/\" \/>\n<meta property=\"og:site_name\" content=\"Tutorial\" \/>\n<meta property=\"article:published_time\" content=\"2021-09-27T11:13:03+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2022-08-08T12:48:18+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/tutorial.eyehunts.com\/wp-content\/uploads\/2021\/09\/Python-static-variable-in-a-function.jpg\" \/>\n<meta name=\"author\" content=\"Rohit\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Rohit\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/tutorial.eyehunts.com\/python\/python-static-variable-in-a-function-example-code\/\",\"url\":\"https:\/\/tutorial.eyehunts.com\/python\/python-static-variable-in-a-function-example-code\/\",\"name\":\"Python static variable in a function | Example code\",\"isPartOf\":{\"@id\":\"https:\/\/tutorial.eyehunts.com\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/tutorial.eyehunts.com\/python\/python-static-variable-in-a-function-example-code\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/tutorial.eyehunts.com\/python\/python-static-variable-in-a-function-example-code\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/tutorial.eyehunts.com\/wp-content\/uploads\/2021\/09\/Python-static-variable-in-a-function.jpg\",\"datePublished\":\"2021-09-27T11:13:03+00:00\",\"dateModified\":\"2022-08-08T12:48:18+00:00\",\"author\":{\"@id\":\"https:\/\/tutorial.eyehunts.com\/#\/schema\/person\/69ca2cb8c13fdce0ee5b39d6175119b1\"},\"description\":\"You can make static variables inside a function in many ways in Python. If declaring a static variable in a function means variable throug...\",\"breadcrumb\":{\"@id\":\"https:\/\/tutorial.eyehunts.com\/python\/python-static-variable-in-a-function-example-code\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/tutorial.eyehunts.com\/python\/python-static-variable-in-a-function-example-code\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/tutorial.eyehunts.com\/python\/python-static-variable-in-a-function-example-code\/#primaryimage\",\"url\":\"https:\/\/i0.wp.com\/tutorial.eyehunts.com\/wp-content\/uploads\/2021\/09\/Python-static-variable-in-a-function.jpg?fit=288%2C136&ssl=1\",\"contentUrl\":\"https:\/\/i0.wp.com\/tutorial.eyehunts.com\/wp-content\/uploads\/2021\/09\/Python-static-variable-in-a-function.jpg?fit=288%2C136&ssl=1\",\"width\":288,\"height\":136},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/tutorial.eyehunts.com\/python\/python-static-variable-in-a-function-example-code\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/tutorial.eyehunts.com\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Python static variable in a function | Example code\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/tutorial.eyehunts.com\/#website\",\"url\":\"https:\/\/tutorial.eyehunts.com\/\",\"name\":\"Tutorial\",\"description\":\"By EyeHunts\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/tutorial.eyehunts.com\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/tutorial.eyehunts.com\/#\/schema\/person\/69ca2cb8c13fdce0ee5b39d6175119b1\",\"name\":\"Rohit\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/tutorial.eyehunts.com\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/tutorial.eyehunts.com\/wp-content\/litespeed\/avatar\/2b27529b86d6dfb5336897e07c93a827.jpg?ver=1777374971\",\"contentUrl\":\"https:\/\/tutorial.eyehunts.com\/wp-content\/litespeed\/avatar\/2b27529b86d6dfb5336897e07c93a827.jpg?ver=1777374971\",\"caption\":\"Rohit\"},\"description\":\"Degree in Computer Science and Engineer: App Developer and has multiple Programming languages experience. Enthusiasm for technology &amp; like learning technical.\",\"url\":\"https:\/\/tutorial.eyehunts.com\/author\/rohit\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Python static variable in a function | Example code","description":"You can make static variables inside a function in many ways in Python. If declaring a static variable in a function means variable throug...","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/tutorial.eyehunts.com\/python\/python-static-variable-in-a-function-example-code\/","og_locale":"en_US","og_type":"article","og_title":"Python static variable in a function | Example code","og_description":"You can make static variables inside a function in many ways in Python. If declaring a static variable in a function means variable throug...","og_url":"https:\/\/tutorial.eyehunts.com\/python\/python-static-variable-in-a-function-example-code\/","og_site_name":"Tutorial","article_published_time":"2021-09-27T11:13:03+00:00","article_modified_time":"2022-08-08T12:48:18+00:00","og_image":[{"url":"https:\/\/tutorial.eyehunts.com\/wp-content\/uploads\/2021\/09\/Python-static-variable-in-a-function.jpg","type":"","width":"","height":""}],"author":"Rohit","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Rohit","Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/tutorial.eyehunts.com\/python\/python-static-variable-in-a-function-example-code\/","url":"https:\/\/tutorial.eyehunts.com\/python\/python-static-variable-in-a-function-example-code\/","name":"Python static variable in a function | Example code","isPartOf":{"@id":"https:\/\/tutorial.eyehunts.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/tutorial.eyehunts.com\/python\/python-static-variable-in-a-function-example-code\/#primaryimage"},"image":{"@id":"https:\/\/tutorial.eyehunts.com\/python\/python-static-variable-in-a-function-example-code\/#primaryimage"},"thumbnailUrl":"https:\/\/tutorial.eyehunts.com\/wp-content\/uploads\/2021\/09\/Python-static-variable-in-a-function.jpg","datePublished":"2021-09-27T11:13:03+00:00","dateModified":"2022-08-08T12:48:18+00:00","author":{"@id":"https:\/\/tutorial.eyehunts.com\/#\/schema\/person\/69ca2cb8c13fdce0ee5b39d6175119b1"},"description":"You can make static variables inside a function in many ways in Python. If declaring a static variable in a function means variable throug...","breadcrumb":{"@id":"https:\/\/tutorial.eyehunts.com\/python\/python-static-variable-in-a-function-example-code\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/tutorial.eyehunts.com\/python\/python-static-variable-in-a-function-example-code\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/tutorial.eyehunts.com\/python\/python-static-variable-in-a-function-example-code\/#primaryimage","url":"https:\/\/i0.wp.com\/tutorial.eyehunts.com\/wp-content\/uploads\/2021\/09\/Python-static-variable-in-a-function.jpg?fit=288%2C136&ssl=1","contentUrl":"https:\/\/i0.wp.com\/tutorial.eyehunts.com\/wp-content\/uploads\/2021\/09\/Python-static-variable-in-a-function.jpg?fit=288%2C136&ssl=1","width":288,"height":136},{"@type":"BreadcrumbList","@id":"https:\/\/tutorial.eyehunts.com\/python\/python-static-variable-in-a-function-example-code\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/tutorial.eyehunts.com\/"},{"@type":"ListItem","position":2,"name":"Python static variable in a function | Example code"}]},{"@type":"WebSite","@id":"https:\/\/tutorial.eyehunts.com\/#website","url":"https:\/\/tutorial.eyehunts.com\/","name":"Tutorial","description":"By EyeHunts","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/tutorial.eyehunts.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/tutorial.eyehunts.com\/#\/schema\/person\/69ca2cb8c13fdce0ee5b39d6175119b1","name":"Rohit","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/tutorial.eyehunts.com\/#\/schema\/person\/image\/","url":"https:\/\/tutorial.eyehunts.com\/wp-content\/litespeed\/avatar\/2b27529b86d6dfb5336897e07c93a827.jpg?ver=1777374971","contentUrl":"https:\/\/tutorial.eyehunts.com\/wp-content\/litespeed\/avatar\/2b27529b86d6dfb5336897e07c93a827.jpg?ver=1777374971","caption":"Rohit"},"description":"Degree in Computer Science and Engineer: App Developer and has multiple Programming languages experience. Enthusiasm for technology &amp; like learning technical.","url":"https:\/\/tutorial.eyehunts.com\/author\/rohit\/"}]}},"jetpack_featured_media_url":"","jetpack-related-posts":[{"id":20401,"url":"https:\/\/tutorial.eyehunts.com\/python\/static-variable-in-python-basics\/","url_meta":{"origin":20195,"position":0},"title":"Static variable in Python | Basics","author":"Rohit","date":"September 28, 2021","format":false,"excerpt":"Python Static variables are declared a variable inside a class, but outside the function (method). Static variables are also known as class variables in Python. Examples Static variable in Python A simple example code shows that the variables with a value assigned in a class declaration, are static variables. class\u2026","rel":"","context":"In &quot;Python&quot;","block_context":{"text":"Python","link":"https:\/\/tutorial.eyehunts.com\/category\/python\/"},"img":{"alt_text":"Static variable in Python","src":"https:\/\/i0.wp.com\/tutorial.eyehunts.com\/wp-content\/uploads\/2021\/09\/Static-variable-in-Python.jpg?resize=350%2C200&ssl=1","width":350,"height":200},"classes":[]},{"id":19931,"url":"https:\/\/tutorial.eyehunts.com\/python\/python-class-static-variable-example-code\/","url_meta":{"origin":20195,"position":1},"title":"Python class static variable | Example code","author":"Rohit","date":"September 22, 2021","format":false,"excerpt":"Which variables declared inside the class definition, but not inside a method are class or static variables in Python. This is different from C++ and Java, but not so different from C#, where a static member can't be accessed using a reference to an instance. When defining some member variable\u2026","rel":"","context":"In &quot;Python&quot;","block_context":{"text":"Python","link":"https:\/\/tutorial.eyehunts.com\/category\/python\/"},"img":{"alt_text":"Python class static variable","src":"https:\/\/i0.wp.com\/tutorial.eyehunts.com\/wp-content\/uploads\/2021\/09\/Python-class-static-variable.jpg?resize=350%2C200&ssl=1","width":350,"height":200},"classes":[]},{"id":36445,"url":"https:\/\/tutorial.eyehunts.com\/python\/python-static-object\/","url_meta":{"origin":20195,"position":2},"title":"Python static object","author":"Rohit","date":"July 7, 2023","format":false,"excerpt":"In Python, there is no concept of a \"static object\" in the same way it exists in some other programming languages like Java or C++. However, you can achieve similar functionality using class attributes or module-level variables. Class-level attributes: In Python, you can define class attributes, which are shared by\u2026","rel":"","context":"In &quot;Python&quot;","block_context":{"text":"Python","link":"https:\/\/tutorial.eyehunts.com\/category\/python\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/tutorial.eyehunts.com\/wp-content\/uploads\/2023\/07\/Python-static-object.jpg?resize=350%2C200&ssl=1","width":350,"height":200},"classes":[]},{"id":3016,"url":"https:\/\/tutorial.eyehunts.com\/python\/python-class-variables-static-instance\/","url_meta":{"origin":20195,"position":3},"title":"Python Class Variables Initialization | Static | Instance","author":"Rohit","date":"October 31, 2018","format":false,"excerpt":"Python class variables shared by all objects, not only in python, almost every programming language. Which Variables\u00a0are defined or assigned value class level is class variable in python. If a variable is assigned value or defines an Inside the class function that is called instance variables. In this tutorial, we\u2026","rel":"","context":"In &quot;Python&quot;","block_context":{"text":"Python","link":"https:\/\/tutorial.eyehunts.com\/category\/python\/"},"img":{"alt_text":"Python Class Variables Initialization Static Instance example","src":"https:\/\/i0.wp.com\/tutorial.eyehunts.com\/wp-content\/uploads\/2018\/10\/Python-Class-Variables-Initialization-Static-Instance-example.png?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/tutorial.eyehunts.com\/wp-content\/uploads\/2018\/10\/Python-Class-Variables-Initialization-Static-Instance-example.png?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/tutorial.eyehunts.com\/wp-content\/uploads\/2018\/10\/Python-Class-Variables-Initialization-Static-Instance-example.png?resize=525%2C300&ssl=1 1.5x, https:\/\/i0.wp.com\/tutorial.eyehunts.com\/wp-content\/uploads\/2018\/10\/Python-Class-Variables-Initialization-Static-Instance-example.png?resize=700%2C400&ssl=1 2x"},"classes":[]},{"id":41313,"url":"https:\/\/tutorial.eyehunts.com\/python\/python-type-hints\/","url_meta":{"origin":20195,"position":4},"title":"Python type hints","author":"Rohit","date":"July 26, 2023","format":false,"excerpt":"Python type hints are a way to annotate the types of variables, function arguments, and return values in Python code. They are used to provide additional information about the expected data types, making the code more readable and enabling static type checkers to catch potential type-related errors. Type hints were\u2026","rel":"","context":"In &quot;Python&quot;","block_context":{"text":"Python","link":"https:\/\/tutorial.eyehunts.com\/category\/python\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/tutorial.eyehunts.com\/wp-content\/uploads\/2023\/07\/Python-type-hints.jpg?resize=350%2C200&ssl=1","width":350,"height":200},"classes":[]},{"id":12033,"url":"https:\/\/tutorial.eyehunts.com\/js\/javascript-static-variable-create-and-use-examples\/","url_meta":{"origin":20195,"position":5},"title":"JavaScript static variable | Create and Use examples","author":"Rohit","date":"March 2, 2021","format":false,"excerpt":"First, static variables preserve their previous value in their previous scope and are not initialized again in the new scope. But JavaScript doesn\u2019t support static variables or a direct way to create them. There is no static keywords in JavaScript. But you can implement function static variables in JavaScript and\u2026","rel":"","context":"In &quot;JavaScript&quot;","block_context":{"text":"JavaScript","link":"https:\/\/tutorial.eyehunts.com\/category\/js\/"},"img":{"alt_text":"Create JavaScript static variable","src":"https:\/\/i0.wp.com\/tutorial.eyehunts.com\/wp-content\/uploads\/2021\/03\/Create-JavaScript-static-variable.png?resize=350%2C200&ssl=1","width":350,"height":200},"classes":[]}],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/tutorial.eyehunts.com\/wp-json\/wp\/v2\/posts\/20195","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/tutorial.eyehunts.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/tutorial.eyehunts.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/tutorial.eyehunts.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/tutorial.eyehunts.com\/wp-json\/wp\/v2\/comments?post=20195"}],"version-history":[{"count":1,"href":"https:\/\/tutorial.eyehunts.com\/wp-json\/wp\/v2\/posts\/20195\/revisions"}],"predecessor-version":[{"id":32154,"href":"https:\/\/tutorial.eyehunts.com\/wp-json\/wp\/v2\/posts\/20195\/revisions\/32154"}],"wp:attachment":[{"href":"https:\/\/tutorial.eyehunts.com\/wp-json\/wp\/v2\/media?parent=20195"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/tutorial.eyehunts.com\/wp-json\/wp\/v2\/categories?post=20195"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/tutorial.eyehunts.com\/wp-json\/wp\/v2\/tags?post=20195"},{"taxonomy":"post_series","embeddable":true,"href":"https:\/\/tutorial.eyehunts.com\/wp-json\/wp\/v2\/post_series?post=20195"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}