6

aka if I have a function var nameNorm= name.substring(1).toLowerCase();

what would the order be? would it turn everything lowercase then extract a substring or would it extract a substring and then turn the substring lowercase?

1
  • This really has nothing at all to do with prototypes, at least in any direct way. It's about the syntactic binding of operators in the expression grammar. Commented Jul 13, 2014 at 3:12

2 Answers 2

11

The . operator associates left-to-right.

so you would do the substring first, then the lower case.

Sign up to request clarification or add additional context in comments.

2 Comments

can we decide about the order in name(), in case we want to receive same result with any order?
@AriShojaei: I'm afraid I don't understand the question. name here is not a function.
8

It executes from left to right. So substring(1) executes, then toLowerCase() executes on the resulting substring.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.