Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Firstly, your expression <code>('Banners' ||'Homepage Updates')</code> will always be evaluated to <code>'Banners'</code>.<br> The logical operator <strong>OR</strong> ( written as <code>||</code>) is evaluated as : </p> <pre><code>boolean OR boolean </code></pre> <p>Since the first expression's argument is a String that is not empty, it is automatically converted to a <code>true</code> value (because of the automatic type-conversion. </p> <p>In your case, I suggest You use an array of possible values to for your objects.<br> This way, you can choose the appropriate one:</p> <pre><code>var projectTypes = new Array ( {id : '660' , value: ['Banners', 'Homepage Updates']}, {id : '659' , value: ['Banners', 'Homepage Updates']}, {id : '661' , values: ['Banners']}, {id : '662' , values: ['Banners']}, {id : '663' , values: ['Banners']}, {id : '668' , values: ['Redirect']}, {id : '229' , values: ['Affiliates']}, {id : '236' , values: ['Affiliates']}, {id : '242' , values: ['Affiliates']}, {id : '250' , values: ['Affiliates']}, {id : '251' , values: ['Resources']}, {id : '375' , values: ['Resources']}, {id : '376' , values: ['Resources']}, {id : '377' , values: ['Ads']}, {id : '237' , values: ['Ads']} ); </code></pre> <p>If I understand correctly and you want to access some ids based on a value, you could organize your objects like this : </p> <pre><code>var projectTypes = { 'Banners' : [660, 659, 661, 662, 663], 'Homepage Updates' : [660, 659], 'Redirect' : [668], 'Affiliates' : [229, 236, 242, 250], 'Resources' : [251, 375, 376], 'Ads' : [237, 377] }; </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload