Integer
ELI5 — The Vibe Check
An integer is a whole number — no decimal point. 1, 42, -7, 1000 are integers. 1.5 is NOT an integer, that is a float. Most languages have separate types for whole numbers and decimal numbers because computers store them differently in memory.
Real Talk
An integer is a numeric data type representing whole numbers without a fractional component. In most languages, integers have a fixed size (8, 16, 32, or 64 bits) determining their range. A 32-bit signed integer holds -2,147,483,648 to 2,147,483,647. JavaScript has no integer type — only 64-bit floats — but provides BigInt for arbitrary precision integers.
Show Me The Code
// Python integers (arbitrary precision):
age = 25
big_number = 99999999999999999999 # no overflow in Python
// JavaScript (no true integer type):
const x = 42; // stored as float64
const y = 42.0; // same thing
console.log(42 === 42.0); // true!
// Check if integer in JS:
Number.isInteger(42); // true
Number.isInteger(42.5); // false
// BigInt for large numbers:
const big = 9007199254740993n; // n suffix = BigInt
When You'll Hear This
"The ID field should be an integer." / "Be careful with integer overflow in C — use a larger type if needed."
Related Terms
Float
A float is a number with a decimal point — 3.14, 1.5, -0.001. The name comes from 'floating point' because the decimal point can be anywhere.
NaN (Not a Number)
NaN means 'Not a Number' — it is what JavaScript gives you when math goes wrong in a weird way. Try to parse a word as a number and you get NaN.
Type
A type tells the computer what kind of thing a value is — is it a number, text, true/false, or a list?