Don P
Don P

Reputation: 63567

Set a js variable in FireBug console

In Firefox's FireBug console, why does this happen?

>>> a = 1
1

>>> var a = 50
undefined

>>> a 
50

I'm just trying to learn me some js!

Upvotes: 1

Views: 889

Answers (1)

SLaks
SLaks

Reputation: 887295

var ... is a statement.

Statements do not have values, so the console prints undefined as the result of the statement.

Upvotes: 4

Related Questions