JavaScript logoJavaScript/
JS-V008

Prefer to use dot notation whenever possibleJS-V008

Minor severityMinor
Anti-pattern categoryAnti-pattern
vue

In JavaScript, one can access properties using the dot notation object.property or square-bracket notation object['property']. However, the dot notation is often preferred because it is easier to read, less verbose, and works better with aggressive JavaScript minimizers.

Bad Practice

var x = object['property'];
var x = object.property;

var x = object[property];    // Property name is a variable, square-bracket notation required