

- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
What are Complex Data types in JavaScript?
Complex Data Type in JavaScript includes the typeof operator. The typeof operator is a unary operator that is placed before its single operand, which can be of any type. Its value is a string indicating the data type of the operand.
The typeof operator evaluates to "number", "string", or "boolean" if its operand is a number, string, or boolean value and returns true or false based on the evaluation.
Example
You can try to run the following code to learn how to work with typeof operator in JavaScript −
<html> <body> <script> <!-- var a = 10; var b = "String"; var linebreak = "<br />"; result = (typeof b == "string" ? "B is String" : "B is Numeric"); document.write("Result => "); document.write(result); document.write(linebreak); result = (typeof a == "string" ? "A is String" : "A is Numeric"); document.write("Result => "); document.write(result); document.write(linebreak); //--> </script> </body> </html>
- Related Questions & Answers
- What are primitive data types in JavaScript?
- What are JavaScript data types and data structures?
- Why JavaScript Data Types are Dynamic?
- What are Primitive and Non-Primitive Data Types in JavaScript?
- What are different Perl Data Types?
- Python – Extract rows with Complex data types
- What are primitive data types in Java?
- What are reference data types in Java?
- What are enumerated data types in C++?
- What are pointer data types in C#?
- What are nullable data types in C#?
- What are dynamic data types in C#?
- What are object data types in C#?
- What are reference data types in C#?
- What are the data types, value types and reference types in C#?
Advertisements