In JavaScript, is the dot . always an operator?
For example:
AnObject.aMethod()
Are there any examples where the dot . is not an operator?
No.
"Strings."/regular.expressions/1.2 // Numbers// Comments.It's not an operator in numeric literals
var x = 12.5;
While it's common to describe member access . as an operator I think this is somewhat incorrect in languages like Java, Javascript, C or C++.
Other binary operators have an expression on the left and an expression on the right, while the member access operator doesn't allow an expression on the right, but just a field identifier ... i.e. a quite specific syntax form.
For example for other binary operators it makes sense to talk about left or right associativity (i.e. if a op b op c is a op (b op c) or (a op b) op c) while this is a nonsense question about member access because only one of the two forms is syntactically valid (you cannot even write a.(b)). Same goes for precedence.
If the question is not about operators in terms of associativity or precedence but just in term of character in an expression (i.e. the question is when the dot character in an expression is not denoting member access) then clearly you have the floating point numbers (where it plays the decimal point role), the dot character in string literals (whe it plays itself... the role of a single dot character) and the dot character in regular expressions (where it means either itself again or "any character" depending on if it's escaped or not, respectively).
Also as Quentin remembered me you can have dots in comments, where the meaning is left to human interpretation.
Besides those already stated (such as numbers, strings and regular expressions), the dot punctuation may not always work. So, in such cases, where the property you are trying to access has a special character, . will not be a valid operator :
var obj = {
'prop1' : null,
'prop-2' : null
};
obj.prop1;//it works
obj.prop-2;// it doesn't work. you should access with via the brackets operator : obj['prop-2'];
My point was that there are cases in which the dot is not always a valid operator (even when you think it would be).
prop-2 that isn't a valid identifier.