{"id":12770,"date":"2020-03-03T12:51:37","date_gmt":"2020-03-03T20:51:37","guid":{"rendered":"https:\/\/careerkarma.com\/blog\/?p=12770"},"modified":"2023-12-01T02:31:22","modified_gmt":"2023-12-01T10:31:22","slug":"javascript-typeof","status":"publish","type":"post","link":"https:\/\/careerkarma.com\/blog\/javascript-typeof\/","title":{"rendered":"JavaScript typeof"},"content":{"rendered":"\n<p>Data types are used to store a particular type of data in a programming language. For example, strings can be used to store text-based data in code, whereas numbers can be used to store integers and floating-point numbers.<\/p>\n\n\n\n<p>When you\u2019re working with data types in JavaScript, you may want to find out which type of data a particular value holds. That\u2019s where the typeof method comes in. The JavaScript typeof operator can be used to determine the type of a particular item in your code. This can be useful if you want to check whether data holds the type your program expects, which is a common operation in programming.<\/p>\n\n\n\n<p>In this tutorial, we are going to discuss data types in JavaScript and how you can use the typeof operator to find out the type of data a particular value holds. We will also explore a number of examples of the typeof operator being used in action.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">JavaScript Data Type Refresher<\/h2>\n\n\n\n<p>JavaScript features a number of data types which can be used to classify a certain type of data. Each type of data is treated differently by JavaScript, and each data type has its own methods that can only be used with data structured in the appropriate format.<\/p>\n\n\n\n<p>JavaScript uses dynamic data types, which means that the type of data is checked during runtime instead of when the program is being compiled. This means that a variable of the same name can be used to hold different types of data.<\/p>\n\n\n\n<p>In JavaScript, there are six basic data types that can be used to hold particular types of data, which are: <code>string<\/code>, <code>number<\/code>, <code>boolean<\/code>, <code>object<\/code>, <code>array<\/code>, and <code>function<\/code>. Later in this article, we have a reference guide which explains how these values work.<\/p>\n\n\n\n<p>Each of these six data types works in different ways. So, when you\u2019re programming, you may want to determine how a particular value is stored so you know how you should be working with the data. For example, how you work with a string will be different to how you would work with a number.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">JavaScript typeof<\/h2>\n\n\n\n<p><code>typeof<\/code> is a built-in JavaScript operator that returns a string indicating the type of data a particular value holds. The operator can be used to find the type of data held by any value, or it can be used to find the type of a variable.<\/p>\n\n\n\n<p>Here is the syntax for the <code>typeof<\/code> operator:<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>typeof data_object<\/pre><\/div>\n\n\n\n<p>So, let\u2019s say that you have a variable called <code>phone_name<\/code> and you want to check its data type. You could do so using the following code:<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>var phone_name = \"iPhone 11\";\nconsole.log(typeof phone_name);<\/pre><\/div>\n\n\n\n<p>Our code returns: <code>string<\/code>. On the first line, we declare a variable called <code>phone_name<\/code> which holds the string value <code>iPhone 11<\/code>. Then, on the next line, we use <code>typeof<\/code> to check the type of data held in our variable. In this case, the program returns <code>string<\/code>.<\/p>\n\n\n\n<p>We can check any type of data in JavaScript. Here\u2019s an example of <code>typeof<\/code> being used to check the value of a variable that has been assigned a Boolean:<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>var phone_in_stock = true;\nconsole.log(typeof phone_in_stock);<\/pre><\/div>\n\n\n\n<p>The <code>typeof<\/code> operator returns: <code>boolean<\/code>.&nbsp;<\/p>\n\n\n\n<p>The <code>typeof<\/code> function is often used to compare the data type held by a variable. So, if you wanted to check whether or not <code>phone_name<\/code> was a string, and run a block of code if <code>phone_name<\/code> was a string, you could do so using <code>typeof<\/code>. Here\u2019s an example of an if statement that will execute a block of code if <code>phone_name<\/code> is a string:<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>var phone_name = \"iPhone 11\";\nif (typeof phone_name === \"string\") {\n\tconsole.log(\"The variable 'phone_name' is a string.\");\n};<\/pre><\/div>\n\n\n\n<p>Our code returns:<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>The variable 'phone_name' is a string.<\/pre><\/div>\n\n\n\n<p>There\u2019s a lot going on in our code, so let\u2019s break it down. On the first line, we declare a variable called <code>phone_name<\/code> and assign it the value <code>iPhone 11<\/code>. Then, we create an <code>if<\/code> statement that checks whether or not the <code>typeof<\/code> <code>phone_name<\/code> is equal to <code>string<\/code>.<\/p>\n\n\n\n<p>In this case, the variable <code>phone_name<\/code> is a string, so the code within our <code>if<\/code> statement is executed. Hence, the output of our program was <code>The variable phone_name is a string<\/code>.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">JavaScript Typeof Arrays and Objects<\/h2>\n\n\n\n<p>When you\u2019re working with JavaScript arrays and object literals, the <code>typeof<\/code> function will not return the specific type of object with which you are working. Instead, it will return the label <code>object<\/code>. Here\u2019s an example of <code>typeof<\/code> being used on both an array and a dictionary:<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>var sandwich_fillings = ['Ham', 'Cheese', 'Egg Mayo'];\nvar ham_sandwich = { name: 'Ham', price: 2.50 };\nconsole.log(typeof sandwich_fillings);\nconsole.log(typeof ham_sandwich);<\/pre><\/div>\n\n\n\n<p>Our code returns:<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>object\nobject<\/pre><\/div>\n\n\n\n<p>As you can see, our program has returned <code>object<\/code> to describe both the types of data with which we are working, even though our <code>sandwich_fillings<\/code> variable has been assigned an array, and <code>ham_sandwich<\/code> has been assigned a dictionary. This is because <code>object<\/code> is used as a generic value to describe more complex data types in JavaScript. <\/p>\n\n\n\n<h2 class=\"wp-block-heading\">JavaScript Typeof Undefined and Null<\/h2>\n\n\n\n<p>The <code>typeof<\/code> operator also returns different values for null and undefined. When you\u2019re working with a <code>null<\/code> value, <code>typeof<\/code> will return an <code>object<\/code>, and <code>undefined<\/code> will return its own <code>undefined<\/code> value. Here\u2019s an example of these data types in action:<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>console.log(typeof null);\nconsole.log(typeof undefined);<\/pre><\/div>\n\n\n\n<p>Our code returns:<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>object\nundefined<\/pre><\/div>\n\n\n\n<p>As you can see, <code>null<\/code> is considered an <code>object<\/code>, and <code>undefined<\/code> has its own value called <code>undefined<\/code>. So, if you\u2019re working with these types of data, remember that they will return these values.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">JavaScript Data Types<\/h2>\n\n\n\n<p>As we discussed earlier, JavaScript offers six main data types which classify particular types of data. These six data types can be divided into three categories: <code>primitive<\/code>, <code>composite<\/code>, and <code>special<\/code>.<\/p>\n\n\n\n<p>Strings, numbers, and booleans are all primitive data types, which means they are primary data types. Objects, arrays, and functions are all considered composite data types, and are all types of objects. Undefined and null are considered special data types.<\/p>\n\n\n\n<p>Let\u2019s break down the main types of data in JavaScript to illustrate what you can expect when you\u2019re working with the <code>typeof<\/code> operator.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Numbers typeof<\/h3>\n\n\n\n<p>JavaScript has one number type which stores both integers and floating-point numbers. As a result, numbers are able to store both decimal and non-decimal numbers. Here\u2019s an example of a number in JavaScript:<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>var espresso_price = 1.80;<\/pre><\/div>\n\n\n\n<p>When you use <code>typeof<\/code> on a number, the following will be returned: <code>number<\/code>.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Strings typeof<\/h3>\n\n\n\n<p>Strings are sequences of one or more characters and can include letters, numbers, symbols, and whitespaces. Strings represent text-based data, and can be declared using either single quotes (<code>\u2018\u2019<\/code>), double quotes (<code>\u201c\u201d<\/code>), or backticks (<code>``<\/code>).<\/p>\n\n\n\n<p>Here\u2019s an example of a string in JavaScript:<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>var espresso_name = \"Espresso\";\n\"typeof\" returns \"string\" for any string data type.<\/pre><\/div>\n\n\n\n<h3 class=\"wp-block-heading\">Booleans typeof<\/h3>\n\n\n\n<p>Booleans can store one of two values: either true or false. Booleans are used to represent whether or not a condition has been met, and are often used in mathematical logic. Here\u2019s an example of a boolean in JavaScript:<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>var espresso_in_stock = true;\n\"typeof\" returns \"boolean\" for the Boolean data type.<\/pre><\/div>\n\n\n\n<h3 class=\"wp-block-heading\">Arrays typeof<\/h3>\n\n\n\n<p>Arrays can store multiple values within a single variable, and are defined as a list of comma-separated values enclosed within square brackets (<code>[]<\/code>). Here\u2019s an example of an array in JavaScript:<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>var coffee_menu = ['Latte', 'Cappuccino', 'Espresso', 'Americano', 'Cortado'];\n\"typeof\" returns \"object\" for array data types.<\/pre><\/div>\n\n\n\n<h3 class=\"wp-block-heading\">Objects typeof<\/h3>\n\n\n\n<p>Objects can contain multiple values stores as key\/value pairs. These can be used to store and access data in JavaScript. Objects are declared as a list of key\/value pairs separated by commas and enclosed within curly braces (<code>{}<\/code>).<\/p>\n\n\n\n<p>Here\u2019s an example of an object in JavaScript:<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>var latte_information = { name: 'Latte', price: 2.50, milk: true };\n\"typeof\" returns \"object\" for JavaScript objects.<\/pre><\/div>\n\n\n\n<h3 class=\"wp-block-heading\">Undefined and Null typeof<\/h3>\n\n\n\n<p>The <code>undefined<\/code> value is the default value for a variable with no value assigned. Here\u2019s an example of a variable with the type <code>undefined<\/code>:<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>var coffee;<\/pre><\/div>\n\n\n\n<p>This variable has no value, so it is considered <code>undefined<\/code> by <code>typeof<\/code>.<\/p>\n\n\n\n<p><code>null<\/code> is an object that is used to describe a variable that has no value. Here\u2019s an example of a variable with a <code>null<\/code> value:<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>var coffee = null;<\/pre><\/div>\n\n\n\n<h2 class=\"wp-block-heading\">Conclusion<\/h2>\n\n\n\n<p>The JavaScript <code>typeof<\/code> operator can be used to determine the type of data a particular value holds. <code>typeof<\/code> returns the type of an expression or the type of a variable. The <code>typeof<\/code> operator is useful if you want to figure out how data is stored so you know whether you need to convert data to another type in your program for it to work correctly.<\/p>\n\n\n\n<p>In this tutorial, we explored how to use the <code>typeof<\/code> operator in JavaScript. We also discussed how <code>typeof<\/code> responds to arrays, objects, null, and undefined values. In addition, we briefly covered the main types of data in JavaScript and discussed how <code>typeof<\/code> reacts to those data types.<\/p>\n\n\n\n<p>Now you\u2019re ready to start using the JavaScript <code>typeof<\/code> operator like a professional!<\/p>\n","protected":false},"excerpt":{"rendered":"Data types are used to store a particular type of data in a programming language. For example, strings can be used to store text-based data in code, whereas numbers can be used to store integers and floating-point numbers. When you\u2019re working with data types in JavaScript, you may want to find out which type of&hellip;","protected":false},"author":240,"featured_media":12916,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[11933],"tags":[],"class_list":{"0":"post-12770","1":"post","2":"type-post","3":"status-publish","4":"format-standard","5":"has-post-thumbnail","7":"category-javascript"},"acf":{"post_sub_title":"","sprint_id":"","query_class":"JavaScript","school_sft":"","parent_sft":"","school_privacy_policy":"","has_review":"","is_sponser_post":"","is_guest_post":""},"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v27.4 (Yoast SEO v27.4) - https:\/\/yoast.com\/product\/yoast-seo-premium-wordpress\/ -->\n<title>JavaScript typeof: The Complete Guide | Career Karma<\/title>\n<meta name=\"description\" content=\"The JavaScript typeof operator is used by coders to determine the type of data held by a particular value or variable. Learn about how to use the typeof operator and discover how it works on Career Karma.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/careerkarma.com\/blog\/javascript-typeof\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"JavaScript typeof\" \/>\n<meta property=\"og:description\" content=\"The JavaScript typeof operator is used by coders to determine the type of data held by a particular value or variable. Learn about how to use the typeof operator and discover how it works on Career Karma.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/careerkarma.com\/blog\/javascript-typeof\/\" \/>\n<meta property=\"og:site_name\" content=\"Career Karma\" \/>\n<meta property=\"article:publisher\" content=\"http:\/\/facebook.com\/careerkarmaapp\" \/>\n<meta property=\"article:published_time\" content=\"2020-03-03T20:51:37+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2023-12-01T10:31:22+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/03\/person-using-macbook-1181258.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"1000\" \/>\n\t<meta property=\"og:image:height\" content=\"668\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"James Gallagher\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@career_karma\" \/>\n<meta name=\"twitter:site\" content=\"@career_karma\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"James Gallagher\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"6 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/javascript-typeof\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/javascript-typeof\\\/\"},\"author\":{\"name\":\"James Gallagher\",\"@id\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/#\\\/schema\\\/person\\\/e79364792443fbff794a144c67ec8e94\"},\"headline\":\"JavaScript typeof\",\"datePublished\":\"2020-03-03T20:51:37+00:00\",\"dateModified\":\"2023-12-01T10:31:22+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/javascript-typeof\\\/\"},\"wordCount\":1296,\"commentCount\":0,\"image\":{\"@id\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/javascript-typeof\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/wp-content\\\/uploads\\\/2020\\\/03\\\/person-using-macbook-1181258.jpg\",\"articleSection\":[\"JavaScript\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/careerkarma.com\\\/blog\\\/javascript-typeof\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/javascript-typeof\\\/\",\"url\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/javascript-typeof\\\/\",\"name\":\"JavaScript typeof: The Complete Guide | Career Karma\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/javascript-typeof\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/javascript-typeof\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/wp-content\\\/uploads\\\/2020\\\/03\\\/person-using-macbook-1181258.jpg\",\"datePublished\":\"2020-03-03T20:51:37+00:00\",\"dateModified\":\"2023-12-01T10:31:22+00:00\",\"author\":{\"@id\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/#\\\/schema\\\/person\\\/e79364792443fbff794a144c67ec8e94\"},\"description\":\"The JavaScript typeof operator is used by coders to determine the type of data held by a particular value or variable. Learn about how to use the typeof operator and discover how it works on Career Karma.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/javascript-typeof\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/careerkarma.com\\\/blog\\\/javascript-typeof\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/javascript-typeof\\\/#primaryimage\",\"url\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/wp-content\\\/uploads\\\/2020\\\/03\\\/person-using-macbook-1181258.jpg\",\"contentUrl\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/wp-content\\\/uploads\\\/2020\\\/03\\\/person-using-macbook-1181258.jpg\",\"width\":1000,\"height\":668},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/javascript-typeof\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Blog\",\"item\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"JavaScript\",\"item\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/javascript\\\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"JavaScript typeof\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/\",\"name\":\"Career Karma\",\"description\":\"Latest Coding Bootcamp News &amp; Career Hacks from Industry Insiders\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/#\\\/schema\\\/person\\\/e79364792443fbff794a144c67ec8e94\",\"name\":\"James Gallagher\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/wp-content\\\/uploads\\\/2020\\\/01\\\/james-gallagher-150x150.jpg\",\"url\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/wp-content\\\/uploads\\\/2020\\\/01\\\/james-gallagher-150x150.jpg\",\"contentUrl\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/wp-content\\\/uploads\\\/2020\\\/01\\\/james-gallagher-150x150.jpg\",\"caption\":\"James Gallagher\"},\"description\":\"James Gallagher is a self-taught programmer and the technical content manager at Career Karma. He has experience in range of programming languages and extensive expertise in Python, HTML, CSS, and JavaScript. James has written hundreds of programming tutorials, and he frequently contributes to publications like Codecademy, Treehouse, Repl.it, Afrotech, and others.\",\"url\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/author\\\/jamesgallagher\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"JavaScript typeof: The Complete Guide | Career Karma","description":"The JavaScript typeof operator is used by coders to determine the type of data held by a particular value or variable. Learn about how to use the typeof operator and discover how it works on Career Karma.","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:\/\/careerkarma.com\/blog\/javascript-typeof\/","og_locale":"en_US","og_type":"article","og_title":"JavaScript typeof","og_description":"The JavaScript typeof operator is used by coders to determine the type of data held by a particular value or variable. Learn about how to use the typeof operator and discover how it works on Career Karma.","og_url":"https:\/\/careerkarma.com\/blog\/javascript-typeof\/","og_site_name":"Career Karma","article_publisher":"http:\/\/facebook.com\/careerkarmaapp","article_published_time":"2020-03-03T20:51:37+00:00","article_modified_time":"2023-12-01T10:31:22+00:00","og_image":[{"width":1000,"height":668,"url":"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/03\/person-using-macbook-1181258.jpg","type":"image\/jpeg"}],"author":"James Gallagher","twitter_card":"summary_large_image","twitter_creator":"@career_karma","twitter_site":"@career_karma","twitter_misc":{"Written by":"James Gallagher","Est. reading time":"6 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/careerkarma.com\/blog\/javascript-typeof\/#article","isPartOf":{"@id":"https:\/\/careerkarma.com\/blog\/javascript-typeof\/"},"author":{"name":"James Gallagher","@id":"https:\/\/careerkarma.com\/blog\/#\/schema\/person\/e79364792443fbff794a144c67ec8e94"},"headline":"JavaScript typeof","datePublished":"2020-03-03T20:51:37+00:00","dateModified":"2023-12-01T10:31:22+00:00","mainEntityOfPage":{"@id":"https:\/\/careerkarma.com\/blog\/javascript-typeof\/"},"wordCount":1296,"commentCount":0,"image":{"@id":"https:\/\/careerkarma.com\/blog\/javascript-typeof\/#primaryimage"},"thumbnailUrl":"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/03\/person-using-macbook-1181258.jpg","articleSection":["JavaScript"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/careerkarma.com\/blog\/javascript-typeof\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/careerkarma.com\/blog\/javascript-typeof\/","url":"https:\/\/careerkarma.com\/blog\/javascript-typeof\/","name":"JavaScript typeof: The Complete Guide | Career Karma","isPartOf":{"@id":"https:\/\/careerkarma.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/careerkarma.com\/blog\/javascript-typeof\/#primaryimage"},"image":{"@id":"https:\/\/careerkarma.com\/blog\/javascript-typeof\/#primaryimage"},"thumbnailUrl":"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/03\/person-using-macbook-1181258.jpg","datePublished":"2020-03-03T20:51:37+00:00","dateModified":"2023-12-01T10:31:22+00:00","author":{"@id":"https:\/\/careerkarma.com\/blog\/#\/schema\/person\/e79364792443fbff794a144c67ec8e94"},"description":"The JavaScript typeof operator is used by coders to determine the type of data held by a particular value or variable. Learn about how to use the typeof operator and discover how it works on Career Karma.","breadcrumb":{"@id":"https:\/\/careerkarma.com\/blog\/javascript-typeof\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/careerkarma.com\/blog\/javascript-typeof\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/careerkarma.com\/blog\/javascript-typeof\/#primaryimage","url":"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/03\/person-using-macbook-1181258.jpg","contentUrl":"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/03\/person-using-macbook-1181258.jpg","width":1000,"height":668},{"@type":"BreadcrumbList","@id":"https:\/\/careerkarma.com\/blog\/javascript-typeof\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Blog","item":"https:\/\/careerkarma.com\/blog\/"},{"@type":"ListItem","position":2,"name":"JavaScript","item":"https:\/\/careerkarma.com\/blog\/javascript\/"},{"@type":"ListItem","position":3,"name":"JavaScript typeof"}]},{"@type":"WebSite","@id":"https:\/\/careerkarma.com\/blog\/#website","url":"https:\/\/careerkarma.com\/blog\/","name":"Career Karma","description":"Latest Coding Bootcamp News &amp; Career Hacks from Industry Insiders","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/careerkarma.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/careerkarma.com\/blog\/#\/schema\/person\/e79364792443fbff794a144c67ec8e94","name":"James Gallagher","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/01\/james-gallagher-150x150.jpg","url":"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/01\/james-gallagher-150x150.jpg","contentUrl":"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/01\/james-gallagher-150x150.jpg","caption":"James Gallagher"},"description":"James Gallagher is a self-taught programmer and the technical content manager at Career Karma. He has experience in range of programming languages and extensive expertise in Python, HTML, CSS, and JavaScript. James has written hundreds of programming tutorials, and he frequently contributes to publications like Codecademy, Treehouse, Repl.it, Afrotech, and others.","url":"https:\/\/careerkarma.com\/blog\/author\/jamesgallagher\/"}]}},"_links":{"self":[{"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/posts\/12770","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/users\/240"}],"replies":[{"embeddable":true,"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/comments?post=12770"}],"version-history":[{"count":0,"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/posts\/12770\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/media\/12916"}],"wp:attachment":[{"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/media?parent=12770"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/categories?post=12770"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/tags?post=12770"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}