Code highlights logo

Learn

Getting Started with JavaScript

Data Types

JavaScript has several built-in data types that are used to represent different kinds of values. Some commonly used data types include:

  • Number: Used for numeric values, including integers and floating-point numbers.
  • String: Used for representing textual data, enclosed in single or double quotes.
  • Boolean: Represents a logical value, either true or false.
  • Undefined: A variable that has been declared but has not been assigned a value.
  • Null: The null data type represents the intentional absence of any object value. It is used to assign an empty or non-existent value to a variable.
  • Object: A collection of key-value pairs, enclosed in curly braces.

Examples:

1let age = 25; // Number
2let name = 'John Doe'; // String
3let isStudent = true; // Boolean
4let numbers; // Undefined
5let strings = null; // Null
6let person = { name: 'John', age: 30, profession: 'Developer' }; // Object

Instructions

1.

Print the value "Doe" to the console.

2.

Print the value 2 to the console.

3.

Print the value true to the console.

4.

Print the value 68.9 to the console.

Sign up to start coding

Already have an account?

Sign In

Course content