title: How to deal with null value in realtime database transaction?
body: <p>I would like to have a counter that we can increment or decrement using transaction. I would like not to initialize the counter to 0, insteads it doesn't exist at start. So I would write the increment transaction as below</p>
  <pre><code>ref.transaction(function(counterValue){
      if (counterValue == null) return 1
      else return (counterValue +1)
  },function(error,committed,snapshot){
     if (error){//fail
     }else if (!committed){//aborted
     }else{//successfull
     }
  })
  </code></pre>
  <p>But I'm not sure if the transaction will run correctly since the null value of counterValue could mean no existing node but also when local cache is empty.
  Could anyone please advise me what I should do?</p>