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

View with compliant examples side by side
var x = 1234;
var y = x.length; // BAD_NUMBER_PROPERTY alarm

Compliant Code Example

View with noncompliant examples side by side
var x = 1234;
var y = x.toString().length;

Version

This rule was introduced in DeepScan 1.0.0-alpha.

Was this documentation helpful?