assign freemarker expressions to variables

JavaScript
<#assign x = r"${expression}">

Source

Also in JavaScript: