JavaScript typeof | Find Type of Variable

The typeof operator in JavaScript, is used to find the type of variable/value. For example:

HTML with JavaScript Code
<!DOCTYPE html>
      let x = 10;
      document.write(typeof x, "<BR>");
      document.write(typeof "codescracker", "<BR>");

JavaScript typeof Syntax

The syntax of typeof operator in JavaScript, is:

typeof x

x refers to the variable or value, whose type we need to find.

JavaScript Online Test

« Previous Tutorial Next Tutorial »