typeof value Last updated: 08. Mar 2023

Keyword

The typeof operator returns a string describing the type of the value.

Parameters

Name Type Description
value any

Returns

A string describing the type of the value.

Example

Code example (JS)

JS is normal JavaScript either running in the browser or on the Docly™ server.
write(typeof 123); /* outputs number */
write("\n"); /* new line */
write(typeof "123"); /* outputs string */
write("\n"); /* new line */
write(typeof [1,2,3]); /* outputs object */
write("\n"); /* new line */
write(typeof new Date()); /* outputs object */

Output

The JS code above produces the output shown below:
number
string
object
object