Pulling an attribute from a entity and display it?

This is a mix of JS (supported by button-card) & jinja (not supported).
Should be like

label: |
    [[[
      if (states['sensor.xxxxx'].attributes['trend'] == 'Increasing') ...
    ]]]

Also, suggest to use “>-” instead of “|” here.

update: fixed a wrong 1st “(”

This is what I have now, but it is not working:

weather_allergy:
  name: Allergy
  label: >-
    [[[
      if states('sensor.allergy_index_forecasted_average'].attributes['trend'] == 'Increasing') {
        return '↗ '
      } else {
        return '↘ '
      }
    ]]]

I thought the parathesis are off? I tried this also, but not working.

if (states('sensor.allergy_index_forecasted_average'].attributes['trend']) == 'Increasing') {

Fix the 1st “(”.
my typo.

yep, didn’t notice it. Thanks.
This fixes it:

if (states['sensor.allergy_index_forecasted_average'].attributes['trend'] == 'Increasing') {