That response does not work.
Randy MacDonald
1

“That response does not work.”

I didn’t say (or mean, or imply) “you don’t know that?” and I’m helping you for free out of the kindness of my heart. Keep that in mind.

What I’m trying to do is help you think through things and come to some realizations yourself because science says we learn and remember better when we’re forced to recall and work things out rather than handed answers on a silver platter. If I don’t hand you an answer on a silver platter, try rereading the text, or doing some independent research.

I’m pushing you to work independently on purpose because that’s what good teachers do. They challenge you to work harder. You’ll learn it better that way.

Recall that the article you replied to demonstrated method syntax:

const arr = [1, 2, 3];
arr.map(double); // [2, 4, 6]

A method is a function associated with an object. In this case, the object is the arr array. Notice that the dot notation is used to access the .map() method on the arr object.

In the hypothetical example:

inc . double (2)

JavaScript would see the dot and interpret it as the object property access operator (dot notation). It would treat inc as if it were an object (which it is — functions are objects in JavaScript), and look for a double property on that object, but inc does not have a double property.

The result would be the error: inc.double is not a function

It looks like you were trying to treat the dot like a function composition operator. It doesn’t work because JavaScript does not have a function composition operator, and the syntax you tried to use is already used for a very different purpose.

Show your support

Clapping shows how much you appreciated Eric Elliott’s story.