How to get the native type of a value in JavaScript ? Last Updated : 15 Feb, 2023 Summarize Comments Improve Suggest changes Share Like Article Like Report JavaScript variables can store any type of value. The JavaScript typeof operator can be used to find out the native type of value. It returns a string value indicating the type of the value. Syntax: typeof(value) Possible output values of typeof: TypeResultundefined"undefined"null"object"boolean"boolean"number"number"string"string"symbol"symbol"function"function"object"object" Example: HTML <!DOCTYPE html> <html> <body> <h2>Function returns native type of the value</h2> <strong>Output: </strong><br /> <div id="output"></div> <script> document.getElementById("output").innerHTML = typeof 98 + " " + typeof "geeksforgeeks" + " " + typeof null; </script> </body> </html> Output: Comment More infoAdvertise with us Next Article How to get a key in a JavaScript object by its value ? S swapnil074 Follow Improve Article Tags : JavaScript Web Technologies JavaScript-Questions Similar Reads How to check the type of a variable or object in JavaScript ? In this article, How to Check the Type of a Variable or Object in JavaScript? In JavaScript, the typeof operator is used to determine the typeof an object or variable. JavaScript, on the other hand, is a dynamically typed (or weakly typed) language. This indicates that a variable can have any type o 2 min read How to return the data type of variable in JavaScript ? To return the JavaScript data type of a variable we can use the JavaScript typeof operator. In JavaScript, unlike many other programming languages, we do not specify the type of a variable while declaring it, rather the variable's type is automatically inferred based on the value it holds. In other 3 min read How to get a key in a JavaScript object by its value ? To get a key in a JavaScript object by its value means finding the key associated with a specific value in an object. Given an object with key-value pairs, you want to identify which key corresponds to a particular value, often for searching or data retrieval.How to get a key in a JavaScript object 4 min read How to get the type of DOM element using JavaScript ? The task is to get the type of DOM element by having its object reference. Here we are going to use JavaScript to solve the problem. Approach 1: First take the reference of the DOM object to a variable(Here, In this example an array is made of IDs of the element, then select random ID and select tha 2 min read How to check if a value is object-like in JavaScript ? In JavaScript, objects are a collection of related data. It is also a container for name-value pairs. In JavaScript, we can check the type of value in many ways. Basically, we check if a value is object-like using typeof, instanceof, constructor, and Object.prototype.toString.call(k). All of the ope 4 min read How to check if the value is primitive or not in JavaScript ? To check if the value is primitive we have to compare the value data type. As Object is the non-primitive data type in JavaScript we can compare the value type to object and get the required results. Primitive data types are basic building blocks like numbers and characters, while non-primitive data 3 min read Like