Reputation: 21
I have a following code and I want to be able to assign value of count conditionally.
{% set obj = {
count: CONDITIONAL VALUE,
city: 'London',
country: 'UK'
} %}
I have an object with many properties, I need to check if that object has property counter . If it has I want to assign value of counter to count above else I want to pass 2 as default value to count.
In javascript
i could do:- count: counter || 2
Thank you very much
Upvotes: 1
Views: 548