Non-existent properties of number value should not be accessed

  • BAD_NUMBER_PROPERTY
  • Error
  • Medium
  • No tags

This rule applies when non-existent properties of number value are accessed.

Accessing non-existent properties of number value results in undefined value.

Noncompliant Code Example

var x = 1234;
var y = x.length; // BAD_NUMBER_PROPERTY alarm

Compliant Code Example

var x = 1234;
var y = x.toString().length;

Version

This rule was introduced in DeepScan 1.0.0-alpha.