Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR HTML

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 #}
Source by twig.symfony.com #
 
PREVIOUS NEXT
Tagged: #twig #map
ADD COMMENT
Topic
Name
8+6 =