`${함수명}` 을 이용하여 함수 값을 가져올 수 있습니다.

아래는 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>

+ Recent posts