Are there TYPOs in this lesson or am I being to literal?


#1


https://www.codecademy.com/en/courses/objects-ii/0/2?curriculum_id=506324b3a7dffd00020bf661

LESSON BLOCK

Fun with Functions
Recall that we can add methods (i.e., functions associated with objects) to a constructor:

function someObject() {
this.someMethod = function() {
};
}
Suppose we said var someObj = new someObject();. When we call someObj.someMethod(), the code between the curly brackets { } above will run.

Ok, the above text is the lesson.
And I am brand new to CodeAcademy and programming.
My question is would either of those codes actually work??
function someObject() {
this.someMethod = function() {
};
}
Suppose we said var someObj = new someObject();. When we call someObj.someMethod(), the code between the curly brackets { } above will run.
=====================================================
I don't see how either of those would run at all? What am I missing here?
Please explain...
** shouldn't it say someObject.someMethod(); for the first method run
and
someObj.someObject(); for the second one???

This is very confusing to me. And the only reason I am bringing attention to it... is if I am understanding it correcty... there will be tons of others being confused by it as well.


Replace this line with your code.


#2

I understand and have no problem with the phrase...
someObject() and someMethod() being non-literal references.
but, what they are referencing in the actual code part of the lesson.


#3

OK... I have read through it multiple times... NOW I GET IT!
He has renamed someObject() before he calls it
with: var someObj = new someObject().

ok... i'm good now sorry.
very confusing stuf...


#4

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.