javascript

[javascript] jsp사용시 js template literal 해결

잘할수있을거야 2022. 5. 2. 00:07

jsp의 $로 인식되어 template literal이 무시된다. \을 앞에다가 붙이면 해결된다.

var str = `나는 \${변수}이고, 나이는 \${변수}살 입니다`;

https://medium.com/@daveford/template-literals-not-working-f5f0c7553f8b

 

Template Literals Not Working

If you are using JavaScript’s new template literal syntax in a JSP page it might not work as expected. That’s because JSP and JavaScript…

medium.com