# First-Class Citizen (Computer Science)

In programming, an entity is called First-Class Citizen if all of the following apply:

1. it can be passed as an argument to another function
2. it can be returned as a value
3. it can be assigned as a value

## JavaScript Example​

In JavaScript, functions are treated as First-Class Citizens:

const f = x => x + 1;const g = f => f;// 1. argument: g(f)// 2. return value: return f// 3. assignment: h = g(f)const h = g(f);h(1); // 2

g() serves as a Higher-Order Function as it takes a function as an argument.