DiscordPlaygroundOverview
Async TemplatesAuto XML-EscapingCaveatsCheatsheetNative Code (Evaluate)InterpolateSyntax OverviewPartialsWhitespace Control
ηEta
DiscordPlayground
Syntax

Cheatsheet

Conditionals

<% if (it.someval === "someothervalue") { %>
Display this!
<% } else { %>
They're not equal
<% } %>

Looping over arrays

<% users.forEach(function(user){ %>
  <%= user.first %> <%= user.last %>
<% }) %>

Looping over objects

<% Object.keys(someObject).forEach(function(prop) { %>
  <%= someObject[prop] %>
<% }) %>

Logging to the console

<% console.log("The value of it.num is: " + it.num) %>

Caveats

Previous Page

Native Code (Evaluate)

Next Page

On this page

ConditionalsLooping over arraysLooping over objectsLogging to the console