String functions should not be used on number values

  • BAD_NUMBER_FUNC
  • Error
  • High
  • No tags

This rule applies when string functions are used on number values.

When string functions are called on number values, TypeError exception occurs.

Noncompliant Code Example

var x = 1234;
var y = (x / 100).indexOf('.'); // BAD_NUMBER_FUNC alarm

Compliant Code Example

var x = 1234;
var y = String(x / 100).indexOf('.');

Version

This rule was introduced in DeepScan 1.0.0-alpha.

See