CodeBeginner

var

Also known as var declaration

A JavaScript declaration that creates a function-scoped or global-scoped variable rather than a block-scoped one.

In the real world

function demo() { if (true) { var x = 1; } return x; } returns 1.

Related

Go a little deeper