`${함수명}` 을 이용하여 함수 값을 가져올 수 있습니다.
아래는 html전용 예제 코드입니다.
function test () { return "test!"; } 가 출력됩니다.
<html>
<body>
<div id="show"></div>
<script>
function test () {
return "test!";
}
const target = document.getElementById("show");
target.innerHTML = `${test}`;
</script>
</body>
</html>
'Javascript > 문법' 카테고리의 다른 글
[JS] 유용한 정규식 (콤마, 전화번호 등) ( + ascii 문자) (0) | 2023.10.30 |
---|---|
[JS] &&, ||, ?, ?? 연산자 결과 확인 (0) | 2023.10.09 |
[JS] Object.prototype.toString.call 오브젝트 타입 확인 (0) | 2023.10.02 |