scitools.com

← Metric catalog

Blank Lines (JavaScript) is one of the source-code metrics Understand computes across 17+ languages — browse them in the GUI, export and track them, or script them with the Python API.

Blank Lines (JavaScript)

API IDCountLineBlankJavascript
TargetsArchitectures Files Project
LanguagesWeb
CategoriesLines
CostLookup
TagsWeb Breakdown

Number of blank JavaScript lines.

Only counts blank lines inside an embedded sub-language block; see Blank Lines (HTML) for blank lines in the surrounding page.

For example:

<!DOCTYPE html>
<html>
<head>
  <title>Welcome</title>

  <!-- Greeting script: tracks visits and confirms with the user -->
  <script>
    // Number of times the page has greeted someone
    var greetingCount = 0;

    function greetUser(name) {
      greetingCount++;
      return "Hello, " + name + "!";
    }

    let message = greetUser("Ada");
    console.log(message);

    if (greetingCount > 0) {
      confirm(message);
    }
  </script>
</head>
<body>
  <h1>Welcome to the site</h1>
  <p>Have a look around.</p>
</body>
</html>

Lines 10, 15, and 18, separating the script's declarations and statements, are the only blank JavaScript lines, giving CountLineBlankJavascript = 3.

See Blank Lines (HTML) for blank lines outside embedded scripts, and Blank Lines for the language-independent metric this breaks down.

Targets By Language: