Answers for "twig map"

0

twig map

{% set people = [
    {first: "Bob", last: "Smith"},
    {first: "Alice", last: "Dupond"},
] %}

{{ people|map(p => "#{p.first} #{p.last}")|join(', ') }}
{# outputs Bob Smith, Alice Dupond #}
Posted by: Guest on October-13-2021

Browse Popular Code Answers by Language