How to render inline JavaScript with Jade or Pug?

Sometimes, we want to render inline JavaScript with Jade or Pug.

In this article, we’ll look at how to render inline JavaScript with Jade or Pug.

How to render inline JavaScript with Jade or Pug?

To render inline JavaScript with Jade or Pug, we can use script.

For instance, we write

script.
  if (usingJade)
    console.log('awesome')
  else
    console.log('use jade')

will be compiled to

<script>
  if (usingJade)
    console.log('awesome')
  else
    console.log('use jade')
</script>

Conclusion

To render inline JavaScript with Jade or Pug, we can use script.