Skip to content

Instantly share code, notes, and snippets.

@bharat20185
Created December 23, 2019 10:59
Show Gist options
  • Save bharat20185/4da2df0c189c9153b0cfc9a1665ac94d to your computer and use it in GitHub Desktop.
Save bharat20185/4da2df0c189c9153b0cfc9a1665ac94d to your computer and use it in GitHub Desktop.
<cfscript>
variables.heroes = [
{
'name': 'Iron Man',
'movies': 11
},
{
'name': 'Captain America',
'movies': 7
}
];
variables.heroes.each(
function(hero, index, array) {
writeOutput(hero.name & ' played role in ' & hero.movies & ' movies');
writeOutput('<br />');
}
);
// Using => function
variables.heroes.each((hero, index, array) => {
writeOutput(hero.name & ' played role in ' & hero.movies & ' movies');
writeOutput('<br />');
});
</cfscript>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment