Append value to object on certain condition?
<p>I'm trying to append a value only if a condition is met (distance != "off").</p>

<p>This is what I tried but I cannot get it to work?</p>

<pre><code>var params = {
    q: pizza,
    result_type: "mixed",
    include_entities: "true",
    if(distance != "off") {
        geocode: geolocation,
        }
    rpp: 15,
    page: 1
};
</code></pre>

<p>How can it be done?</p>
