<script th:inline="javascript"> // Enable Thymeleaf inlining
var email = [[${user.email}]]; // Behaves just like in HTML
</script>
You can use local variables. Declare an HTML element with a th:with attribute. For example <div th:with="someVariable=${someValue}"