You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When functions are not defined at the top level but instead attached as part of an object, their arguments don't appear to actually be evaluated. For example below, reverseString works fine when declared as a top level function, but not when referenced as a property of a wrapping object.
I believe it's because . is not really a property access operator, but the a path mapping operator. The docs say: "the LHS [is] known as the context and is used as the basis for any relative path expression on the RHS, and is accessible in the RHS expression using the $ symbol." IOW, a . changes what $ refers to. So in the first example you bind the name to a variable. In the second example there is no . (before the one to get the name). In the third, the $ refers to the the lib object, and there is no property "name" on that object. Shooting from the hip here, but these expressions may work:
When functions are not defined at the top level but instead attached as part of an object, their arguments don't appear to actually be evaluated. For example below,
reverseString
works fine when declared as a top level function, but not when referenced as a property of a wrapping object.MRE
The text was updated successfully, but these errors were encountered: