Answers.Body: <p>You can use <code>{% js %}</code> Twig tag.
  It is essential to using JS in Twig. It takes JS code passed to it and appends it at end of the template, right before ending body tag. Multiple js tags can be used - content from each of them will be concated with the rest. You don't need to wrap code passed to <code>{% js %}</code> into <code>&lt;script&gt;</code> tags - js will do that for you.</p>
  <pre><code>{% js %} 
      console.log('Hello World');
      /* you can add your js code here */
  {% endjs %}
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-12-30T09:28:42.980Z
Answers.LastActivityDate: 2020-12-30T09:28:42.980Z
Answers.UserDisplayName: ZealousWeb
Body: <p>Is there any way to add javascript in craft</p>
  
Tags: <craft3><javascript>
Title: How to include Inline JavaScript?
ThreadText: # How to include Inline JavaScript?
  
  (Asked by: username_0 on 2020-12-30)
  
  Is there any way to add javascript in craft
  
  **Tags:** craft3, javascript
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2020-12-30. Score: 2
  
  You can use `{% js %}` Twig tag.
  It is essential to using JS in Twig. It takes JS code passed to it and appends it at end of the template, right before ending body tag. Multiple js tags can be used - content from each of them will be concated with the rest. You don't need to wrap code passed to `{% js %}` into `<script>` tags - js will do that for you.
  
  ```
  {% js %} 
      console.log('Hello World');
      /* you can add your js code here */
  {% endjs %}
  
  ```
  
  
  ---
  
  