

{"id":112681,"date":"2023-05-02T14:30:05","date_gmt":"2023-05-02T09:00:05","guid":{"rendered":"https:\/\/data-flair.training\/blogs\/?p=112681"},"modified":"2023-05-02T14:36:44","modified_gmt":"2023-05-02T09:06:44","slug":"variables-in-typescript","status":"publish","type":"post","link":"https:\/\/data-flair.training\/blogs\/variables-in-typescript\/","title":{"rendered":"Variables in TypeScript"},"content":{"rendered":"<p>The last article taught us about TypeScript&#8217;s Types, including Classes, Interfaces, and Generics. We&#8217;ll now examine TypeScript variables and investigate the many variables that can be applied in TypeScript applications.<\/p>\n<h3>What is a Variable in TypeScript?<\/h3>\n<p>A variable is a container for a value that can be used in a program. Many data kinds can be stored in variables, including numbers, strings, and objects. The &#8220;let&#8221; keyword, the variable name, and an optional type annotation are used in TypeScript to define variables.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">let DataFlair_name: string = 'John';\r\nlet DataFlair_age: number = 30;\r\nlet DataFlair_isAdult: boolean = true;\r\n<\/pre>\n<p>#IMAGE#<\/p>\n<p>Here, we have defined three variables: &#8220;DataFlair_name&#8221; of type string, &#8220;DataFlair_age&#8221; of type number, and &#8220;DataFlair_isAdult&#8221; of type boolean. TypeScript also provides the &#8220;const&#8221; keyword for defining constants that cannot be reassigned to a new value.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">const PI: number = 3.14;\r\n<\/pre>\n<p>#IMAGE#<\/p>\n<p>Here, we have defined a constant &#8220;PI&#8221; of the type number, with the value of 3.14.<\/p>\n<p>In TypeScript, the var keyword can be used to define variables. Variables defined with var have function scope, which means they are accessible within the function in which they are defined.<\/p>\n<p>Here is an example code that demonstrates the use of var keyword in TypeScript:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">function DataFlair_greet() {\r\n var name = 'Alice';\r\n console.log('Hello, ' + name + '!');\r\n}\r\n\r\n\r\nDataFlair_greet(); \/\/ Output: Hello, Alice!\r\nconsole.log(name); \/\/ Output: error, name is not defined\r\n<\/pre>\n<p>#IMAGE#<\/p>\n<p>In this code, the var keyword is used to define a variable name inside the DataFlair_greet function. This variable is then used to display a greeting message on the console.<\/p>\n<p>Note that the name variable is not accessible outside the DataFlair_greet function because it has a function scope. When we try to access it outside the function, we get an error message saying that the name is not defined.<\/p>\n<p>It&#8217;s worth noting that the var keyword is not recommended in modern TypeScript code because it has some drawbacks. One drawback is that variables defined with var can be accessed before being declared, leading to confusing and error-prone code. Another disadvantage is that variables defined with var have function scope, which can make it harder to reason about code and can lead to bugs. Instead, the let and const keywords are recommended for defining variables in modern TypeScript code because they have block scope and are more predictable in their behavior.<\/p>\n<h3>Types of Variables in TypeScript<\/h3>\n<h4>1. Number<\/h4>\n<p>The number data type represents both floating-point numbers and integers. Number types come in 1, 2, 3.5, 4.7, and other quantities. The keyword &#8220;number&#8221; in TypeScript defines the number type.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">let DataFlair_age: number = 30;\r\nlet DataFlair_pi: number = 3.14;\r\n<\/pre>\n<h4>2. String<\/h4>\n<p>The string data type represents a string of characters. Strings are included within single or double quotation marks. The string type is defined by the TypeScript keyword &#8220;string.&#8221;<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">let DataFlair_name: string = 'John';\r\nlet DataFlair_message: string = 'Hello, world!';\r\n<\/pre>\n<h4>3. Boolean<\/h4>\n<p>The boolean data type represents a binary value that can either be true or false. TypeScript defines the boolean type using the keyword &#8220;boolean.&#8221;<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">let DataFlair_isAdult: boolean = true;\r\nlet DataFlair_hasChildren: boolean = false;\r\n<\/pre>\n<h4>4. Array<\/h4>\n<p>A group of identically typed values is represented by the array data type. Arrays can hold an unlimited number of values of the same type and are defined using square brackets []. The keyword &#8220;Array&#8221; is used in TypeScript to define arrays.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">let DataFlair_numbers: number[] = [1, 2, 3, 4, 5];\r\nlet DataFlair_fruits: string[] = ['apple', 'banana', 'orange'];\r\n<\/pre>\n<h4>5. Tuple<\/h4>\n<p>The tuple data type represents an array with a fixed number of elements of different types. In TypeScript, tuples are defined using square brackets [], and the type of each element is specified in the order.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">let DataFlair_person: [string, number] = ['John', 30];\r\n<\/pre>\n<p>Here, we have defined a tuple &#8220;DataFlair_person&#8221; with two elements: a string and a number. The first element is of type string and the second element is of type number.<\/p>\n<h4>6. Enum<\/h4>\n<p>The enum data type represents a set of named constants. Enums are defined using the keyword &#8220;enum&#8221; and can be assigned a set of named values.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">enum DataFlair_Color {\r\n Red,\r\n Green,\r\n Blue,\r\n}\r\n\r\n\r\nlet myColor: DataFlair_Color = DataFlair_Color.Red;\r\n<\/pre>\n<p>Here, we have defined an enum &#8220;DataFlair_Color&#8221; with three named values: Red, Green, and Blue. We have assigned the value of &#8220;Red&#8221; to the variable &#8220;myColor&#8221;.<\/p>\n<h4>7. Any<\/h4>\n<p>The any data type represents any value and can be used to disable type-checking for a variable. In TypeScript, the any type is defined using the keyword &#8220;any.&#8221;<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">let DataFlair_value: any = 'Hello, world!';\r\nDataFlair_value = 10;\r\nDataFlair_value = true;\r\n<\/pre>\n<p>Here, we have defined a variable &#8220;DataFlair_value&#8221; of type any. We can assign any value to this variable without type-checking.<\/p>\n<h4>8. Void<\/h4>\n<p>The void data type represents the absence of a value. In TypeScript, void is the return type for functions that do not return a value.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">function DataFlair_logMessage(message: string): void {\r\n console.log(message);\r\n}\r\n<\/pre>\n<p>Here, we have defined a function &#8220;DataFlair_logMessage&#8221; that takes a string parameter &#8220;message&#8221; and does not return a value.<\/p>\n<h4>9. Null and Undefined<\/h4>\n<p>The null and undefined data types represent the absence of a value. In TypeScript, null and undefined are treated as subtypes of all other types. That means you can assign null or undefined to a variable of any type.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">let value1: null = null;\r\nlet value2: undefined = undefined;<\/pre>\n<p>Here, we have defined two variables, &#8220;value1&#8221; and &#8220;value2,&#8221; of types null and undefined, respectively.<\/p>\n<h3>Type Annotations in TypeScript<\/h3>\n<p>Developers can use type annotations in TypeScript to specify the type of a variable. A technique to explicitly declare a variable&#8217;s type and guarantee that it is used correctly throughout the application is through type annotations.<\/p>\n<p>Type annotations are defined using the colon &#8220;:&#8221; symbol, followed by the data type. For example:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">let DataFlair_age: number = 30;\r\n<\/pre>\n<p>Here, we have declared a variable &#8220;DataFlair_age&#8221; of the type number and assigned it the value of 30.<\/p>\n<p>Type annotations can be used for function parameters and return types as well. For example:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">function DataFlair_calculateSum(a: number, b: number): number {\r\n return a + b;\r\n}\r\n<\/pre>\n<h3>Redeclaration and Shadowing of Variables in TypeScript<\/h3>\n<p>In TypeScript, it is possible to re-declare variables and to create new variables with the same name as existing variables. This can lead to confusion and unexpected behavior, especially when variables are accessed from different parts of the code.<\/p>\n<p>Here are some examples of re-declaration and shadowing of variables in TypeScript:<\/p>\n<h4>Re-declaration<\/h4>\n<p>Re-declaration occurs when a variable is declared more than once in the same scope.<\/p>\n<p>For example:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">let DataFlair_x = 10;\r\nlet DataFlair_x = 20; \/\/ Error: 'DataFlair_x' has already been declared.\r\n<\/pre>\n<p>In this code, the variable DataFlair_x is declared twice in the same scope, which causes an error.<\/p>\n<h4>Shadowing<\/h4>\n<p>Shadowing occurs when a new variable is declared with the same name as an existing variable in an inner scope.<\/p>\n<p>For example:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">let DataFlair_x = 10;\r\n\r\n\r\nfunction foo() {\r\n let DataFlair_x = 20;\r\n console.log(DataFlair_x); \/\/ Output: 20\r\n}\r\n\r\n\r\nfoo();\r\nconsole.log(DataFlair_x); \/\/ Output: 10\r\n<\/pre>\n<h3>Variable Scope in Typescript<\/h3>\n<p>In TypeScript, variable scope refers to the area of the program where a variable can be accessed. There are three types of variable scopes in TypeScript:<\/p>\n<h4>Global Scope:<\/h4>\n<p>Variables that are declared outside of any function or block have global scope, which means they can be accessed from anywhere in the program. Here&#8217;s an example:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">let DataFlair_globalVar = 'Hello, world!';\r\n\r\n\r\nfunction sayHello() {\r\n console.log(DataFlair_globalVar); \/\/ Output: Hello, world!\r\n}\r\n\r\n\r\nsayHello();\r\nconsole.log(DataFlair_globalVar); \/\/ Output: Hello, world!\r\n<\/pre>\n<p>In this code, the variable DataFlair_globalVar is declared outside of any function, so it has global scope. It can be accessed from both the sayHello function and outside the function.<\/p>\n<h4>Local Scope:<\/h4>\n<p>Variables declared inside a function or block have local scope, meaning they can only be accessed from within that function or block. Here&#8217;s an example:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">function DataFlair_sayHello() {\r\n let localVar = 'Hello, TypeScript!';\r\n console.log(localVar); \/\/ Output: Hello, TypeScript!\r\n}\r\n\r\n\r\nDataFlair_sayHello();\r\nconsole.log(localVar); \/\/ Error: 'localVar' is not defined.\r\n<\/pre>\n<p>The variable localVar is declared inside the DataFlair_sayHello function in this code, so it has local scope. It can only be accessed from within the DataFlair_sayHello function, and attempting to access it outside it results in an error.<\/p>\n<h4>Block Scope:<\/h4>\n<p>Variables declared with let or const inside a block (such as a for loop or an if statement) have block scope, which means they can only be accessed from within that block. Here&#8217;s an example:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">function DataFlair_count() {\r\n for (let i = 0; i &lt; 5; i++) {\r\n   console.log(i);\r\n }\r\n console.log(i); \/\/ Error: 'i' is not defined.\r\n}\r\nDataFlair_count();\r\n<\/pre>\n<p>In this code, the variable i is declared with let inside the for loop, so it has a block scope. It can only be accessed from within the for loop and attempting to access it outside the loop results in an error.<\/p>\n<p>Understanding variable scope is essential in TypeScript programming, as it can help prevent naming conflicts and improve code organization. Using local and block scopes whenever possible is recommended, as this can make code more predictable and easier to maintain.<\/p>\n<h3>Type Assertation in TypeScript<\/h3>\n<p>Type assertion in TypeScript is a way to explicitly tell the TypeScript compiler that you know more about the type of a value than TypeScript does, and to change the type of a variable from one type to another.<\/p>\n<p>There are two ways to perform type assertion in TypeScript:<\/p>\n<h4>1. Angle-bracket syntax<\/h4>\n<p>In this code, the angle-bracket syntax &lt;string&gt; is used to tell the TypeScript compiler that someValue is a string. This allows the .length property to be accessed as if it were a string, and the resulting value is assigned to DataFlair_strLength.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">let DataFlair_strLength: number = (&lt;string&gt;someValue).length;\r\n<\/pre>\n<h4>2. &#8220;as&#8221; syntax<\/h4>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">let DataFlair_strLength: number = (someValue as string).length;\r\n<\/pre>\n<p>The &#8220;as&#8221; keyword is used in this code to perform type assertion. This has the same effect as the angle-bracket syntax but is often preferred in modern TypeScript code.<\/p>\n<p>Type assertion can be helpful in cases where TypeScript&#8217;s type inference system cannot determine the correct type of a variable or when working with APIs that return values with unclear types.<\/p>\n<p>However, using type assertion with care is important, as it can lead to runtime errors if the type assertion is incorrect. It&#8217;s always a good idea to double-check that the type assertion is correct and to use type guards or other techniques to ensure that the type is valid before performing operations on the value.<\/p>\n<h3>Conclusion<\/h3>\n<p>Developers have a great tool with TypeScript variables to define and use values in their applications. TypeScript variables can assist in catching issues at compile-time instead of runtime, lowering the likelihood of bugs in production code. Using TypeScript&#8217;s variables, developers may select the best data type for their use case and make sure their code is reliable and effective.<\/p>\n<p>The many TypeScript variables, such as integer, string, boolean, array, tuple, enum, any, void, null, and undefined, were covered in this article. Explicitly stating the type of a variable, function argument, or return type can be done using type annotations, which were also covered in this discussion.<\/p>\n<p>Developers may write more dependable, scalable, and maintainable code using TypeScript variables and annotations. You can accomplish your objectives and produce high-quality software by using TypeScript variables, whether developing a simple web application or a complex business system.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>The last article taught us about TypeScript&#8217;s Types, including Classes, Interfaces, and Generics. We&#8217;ll now examine TypeScript variables and investigate the many variables that can be applied in TypeScript applications. What is a Variable&#46;&#46;&#46;<\/p>\n","protected":false},"author":581,"featured_media":112963,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[27319],"tags":[27343,27342],"class_list":["post-112681","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-typescript-tutorials","tag-type-annotations-in-typescript","tag-variables-in-typescript"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.8 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Variables in TypeScript - DataFlair<\/title>\n<meta name=\"description\" content=\"A variable is a container for a value that can be used in a program.See typescript variables like integer, string, boolean, array, tuple, etc.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/data-flair.training\/blogs\/variables-in-typescript\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Variables in TypeScript - DataFlair\" \/>\n<meta property=\"og:description\" content=\"A variable is a container for a value that can be used in a program.See typescript variables like integer, string, boolean, array, tuple, etc.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/data-flair.training\/blogs\/variables-in-typescript\/\" \/>\n<meta property=\"og:site_name\" content=\"DataFlair\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/DataFlairWS\/\" \/>\n<meta property=\"article:published_time\" content=\"2023-05-02T09:00:05+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2023-05-02T09:06:44+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2023\/03\/typescript-variables.webp\" \/>\n\t<meta property=\"og:image:width\" content=\"1200\" \/>\n\t<meta property=\"og:image:height\" content=\"628\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/webp\" \/>\n<meta name=\"author\" content=\"DataFlair Team\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@DataFlairWS\" \/>\n<meta name=\"twitter:site\" content=\"@DataFlairWS\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"DataFlair Team\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"9 minutes\" \/>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Variables in TypeScript - DataFlair","description":"A variable is a container for a value that can be used in a program.See typescript variables like integer, string, boolean, array, tuple, etc.","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:\/\/data-flair.training\/blogs\/variables-in-typescript\/","og_locale":"en_US","og_type":"article","og_title":"Variables in TypeScript - DataFlair","og_description":"A variable is a container for a value that can be used in a program.See typescript variables like integer, string, boolean, array, tuple, etc.","og_url":"https:\/\/data-flair.training\/blogs\/variables-in-typescript\/","og_site_name":"DataFlair","article_publisher":"https:\/\/www.facebook.com\/DataFlairWS\/","article_published_time":"2023-05-02T09:00:05+00:00","article_modified_time":"2023-05-02T09:06:44+00:00","og_image":[{"width":1200,"height":628,"url":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2023\/03\/typescript-variables.webp","type":"image\/webp"}],"author":"DataFlair Team","twitter_card":"summary_large_image","twitter_creator":"@DataFlairWS","twitter_site":"@DataFlairWS","twitter_misc":{"Written by":"DataFlair Team","Est. reading time":"9 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/data-flair.training\/blogs\/variables-in-typescript\/#article","isPartOf":{"@id":"https:\/\/data-flair.training\/blogs\/variables-in-typescript\/"},"author":{"name":"DataFlair Team","@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/person\/c187795dc82ab948373cca526df7c445"},"headline":"Variables in TypeScript","datePublished":"2023-05-02T09:00:05+00:00","dateModified":"2023-05-02T09:06:44+00:00","mainEntityOfPage":{"@id":"https:\/\/data-flair.training\/blogs\/variables-in-typescript\/"},"wordCount":1601,"commentCount":0,"publisher":{"@id":"https:\/\/data-flair.training\/blogs\/#organization"},"image":{"@id":"https:\/\/data-flair.training\/blogs\/variables-in-typescript\/#primaryimage"},"thumbnailUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2023\/03\/typescript-variables.webp","keywords":["Type Annotations in TypeScript","Variables in TypeScript"],"articleSection":["TypeScript Tutorials"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/data-flair.training\/blogs\/variables-in-typescript\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/data-flair.training\/blogs\/variables-in-typescript\/","url":"https:\/\/data-flair.training\/blogs\/variables-in-typescript\/","name":"Variables in TypeScript - DataFlair","isPartOf":{"@id":"https:\/\/data-flair.training\/blogs\/#website"},"primaryImageOfPage":{"@id":"https:\/\/data-flair.training\/blogs\/variables-in-typescript\/#primaryimage"},"image":{"@id":"https:\/\/data-flair.training\/blogs\/variables-in-typescript\/#primaryimage"},"thumbnailUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2023\/03\/typescript-variables.webp","datePublished":"2023-05-02T09:00:05+00:00","dateModified":"2023-05-02T09:06:44+00:00","description":"A variable is a container for a value that can be used in a program.See typescript variables like integer, string, boolean, array, tuple, etc.","breadcrumb":{"@id":"https:\/\/data-flair.training\/blogs\/variables-in-typescript\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/data-flair.training\/blogs\/variables-in-typescript\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/data-flair.training\/blogs\/variables-in-typescript\/#primaryimage","url":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2023\/03\/typescript-variables.webp","contentUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2023\/03\/typescript-variables.webp","width":1200,"height":628,"caption":"typescript variables"},{"@type":"BreadcrumbList","@id":"https:\/\/data-flair.training\/blogs\/variables-in-typescript\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Blog Home","item":"https:\/\/data-flair.training\/blogs\/"},{"@type":"ListItem","position":2,"name":"TypeScript Tutorials","item":"https:\/\/data-flair.training\/blogs\/category\/typescript-tutorials\/"},{"@type":"ListItem","position":3,"name":"Variables in TypeScript"}]},{"@type":"WebSite","@id":"https:\/\/data-flair.training\/blogs\/#website","url":"https:\/\/data-flair.training\/blogs\/","name":"DataFlair","description":"Learn Today. Lead Tomorrow.","publisher":{"@id":"https:\/\/data-flair.training\/blogs\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/data-flair.training\/blogs\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/data-flair.training\/blogs\/#organization","name":"DataFlair","url":"https:\/\/data-flair.training\/blogs\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/logo\/image\/","url":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2016\/07\/Data-Flair.png","contentUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2016\/07\/Data-Flair.png","width":106,"height":48,"caption":"DataFlair"},"image":{"@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/DataFlairWS\/","https:\/\/x.com\/DataFlairWS","https:\/\/www.linkedin.com\/company\/dataflair-web-services-pvt-ltd\/","https:\/\/www.youtube.com\/user\/DataFlairWS"]},{"@type":"Person","@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/person\/c187795dc82ab948373cca526df7c445","name":"DataFlair Team","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/2302ebc438084d2f1f993edc1996a0aae01332e81f3227cba8df0c48ec010ca4?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/2302ebc438084d2f1f993edc1996a0aae01332e81f3227cba8df0c48ec010ca4?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/2302ebc438084d2f1f993edc1996a0aae01332e81f3227cba8df0c48ec010ca4?s=96&d=mm&r=g","caption":"DataFlair Team"},"description":"DataFlair Team provides high-impact content on programming, Java, Python, C++, DSA, AI, ML, data Science, Android, Flutter, MERN, Web Development, and technology. We make complex concepts easy to grasp, helping learners of all levels succeed in their tech careers.","url":"https:\/\/data-flair.training\/blogs\/author\/dfteam6\/"}]}},"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts\/112681","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/users\/581"}],"replies":[{"embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/comments?post=112681"}],"version-history":[{"count":4,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts\/112681\/revisions"}],"predecessor-version":[{"id":112965,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts\/112681\/revisions\/112965"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/media\/112963"}],"wp:attachment":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/media?parent=112681"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/categories?post=112681"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/tags?post=112681"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}