← All practice pages

JavaScript

JavaScript Variables & Types

JavaScript holds values in variables declared with let or const, and works out their type at run time. Knowing which type you actually have avoids most beginner bugs.

Try it now

Write a function "typeChecker" that takes any value and returns a string describing its type: "string", "number", "boolean", "array", "object", "null", or "undefined".

Create a free account to run your answer and get ARIA's review.