<!DOCTYPE html>
<html>
<body>

<button onclick="myFunction()">Try it</button>

<p id="demo"></p>

<script>
function myFunction() {
  var x = document.scripts.length;
  window.alert(x);
}
</script>

</body>
</html>