Berikut adalah contoh untuk merender array multi-dimensi dalam sebuah template:
Contoh 1
'use strict';
var Mustache = require('mustache');
var view = {test: 'div content', multiple : ['foo', 'bar'], multiple_2 : ['hello', 'world']};
var template = '<div>{{test}}</div><ul>{{#multiple}}<li>{{.}}</li>{{/multiple}}</ul><ul>{{#multiple_2}}<li>{{.}}</li>{{/multiple_2}}</ul>';
var output = Mustache.render(template, view);
console.log(output);
Contoh 2
'use strict';
var Mustache = require('mustache');
var view = {test: 'div content', multiple : [{name: 'foo', gender: 'male'}, {name: 'bar', gender: 'female'}], multiple_2 : [{text: 'Hello', append: '**', prepend: '**'}, {text: 'World', append: '**', prepend: '**'}]};
var template = '<div>{{test}}</div><ul>{{#multiple}}<li>Hello my name is {{name}}. And I am {{gender}}</li>{{/multiple}}</ul><ul>{{#multiple_2}}<li>{{prepend}}_{{text}}_{{append}}</li>{{/multiple_2}}</ul>';
var output = Mustache.render(template, view);
console.log(output);
Untuk uji coba, simpan contoh di atas dalam file bernama 'test.js', jalankan perintah berikut di baris perintah
nodejs test.js
Mustache.render('<ul>{{#.}}<li>{{.}}</li>{{/.}}</ul>',['foo','bar','baz']);