Example 3: Snippet Output Using JavaScript Object as Argument

The example below shows how to return object as an argument.

Snippet code:

<!--{ var opts = arguments[0] }-->

<!--{if opts.displayFirstTitle }-->

        <h1>First Title</h1>

<!--{/if}-->

<!--{if opts.displaySecondTitle }-->

    <h2>Second Title</h2>

<!--{/if}-->

Template code:

<!--{ call sample_snippet({displayFirstTitle: true, displaySecondTitle: false}) }-->

You will get the “First Title” heading in the resulting mobile page.

So, you can use true and false values to return the objects you need.