Data Types in JavaScript
Sveip for å vise menyen
JavaScript works with different types of data. The most common ones are strings, numbers, and booleans.
A string is text:
const name = "John";
A number is a numeric value:
const age = 25;
A boolean represents a true or false value:
const isLoggedIn = true;
There are also two special values: null and undefined.
undefined means a variable has been declared but has no value:
let value;
console.log(value); // undefined
null is an intentional absence of value:
const data = null;
Understanding these types is important because JavaScript behaves differently depending on the type of data you are working with.
Alt var klart?
Takk for tilbakemeldingene dine!
Seksjon 1. Kapittel 5
Spør AI
Spør AI
Spør om hva du vil, eller prøv ett av de foreslåtte spørsmålene for å starte chatten vår
Seksjon 1. Kapittel 5