I have a function that goes something like
//denominator is a passed argument. Integer
/*priceData will either be an empty array, or an array
that looks something like this
priceData = {
  'splitBy2' : [0.5, 0.5],
  'splitBy3' : [0.34, 0.33,0.33],
  'splitBy4': [0.25, 0.25, 0.25, 0.25]
}
*/
//Returns list of values. Currency distribution. Eg if denominator = 3
//Then distribution will equal [0.34, 0.33,0.33]
distribution = distributionToArray(currency(totalPrice).distribute(denominator))
//This check doesn't work.
if(typeof (priceData['splitBy'+denominator]) !== 'undefined' && (priceData['splitBy'+denominator]).length == 0){
                priceData['splitBy'+denominator] = distribution;
    }   
What I want to do is check if priceData['splitBy'+denominator] is empty. And if it isn't, create it.
So let
denominator=5
priceData = {
  'splitBy2' : [0.5, 0.5],
  'splitBy3' : [0.34, 0.33,0.33],
  'splitBy4': [0.25, 0.25, 0.25, 0.25]
}
I want to check if priceData['splitBy5'] is set, and if it's not, run the rest of the function priceData['splitBy5] = distribution;` to create it. Even if priceData is empty.


