Demo - Line number starts from a different value

Using the .dyCodeHighlighter and .line-numbers class

Use the data-dyCodeHighlighter-line-start attribute to start the line number from a given value.

In the following example line number starts from 10.

/**
 * This is a sample program to print the following pattern.
 *
 * H
 * Ha
 * Hap
 * Happ
 * Happy
 */
var
  str = "Happy",
  len = str.length,
  r,
  c,
  pattern;

for (r = 0; r < len; r++) {
  pattern = '';
  for (c = 0; c <= r; c++) {
    pattern += str[c];
  }
  console.log(pattern);
}

In the following code the line numbers starts from 1.

var x = 10;
var y = 20;
var sum = x + y;
console.log(sum);