BNewing / calculator

Javascript exercise
0 stars 0 forks source link

replacing nothing with null #1

Closed markdessain closed 8 years ago

markdessain commented 8 years ago

1. "Nothing" or null

As you have noticed sometimes you want to have a variable that starts off without a value. Thankfully programming languages have a way to do this.

The value null represents the intentional absence of any object value.

https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/null https://docs.python.org/2/library/constants.html#None

(I know, why are all languages different!!)


2. sign===null or !sign

These two statement are actually the same. The ! means not. So we are saying

# does sign not have a value
!sign

which is the same as saying

# is sign equal to null
sign===null

But pleaes pick which ever makes more sense to you!

I've include the highlighted code, hopefully that all makes sense.