Is anyone else getting error messages for no reason?

Is anyone else getting error messages for no reason?

To complete the first task of extending the HospitaEployee class with an empty class called ‘Nurse’, I put this:

class Nurse extends HospitalEmployee {

}
but js.lint is telling me there’s an unexpected indentifier:

/home/ccuser/workspace/learn-javascript-classes-classes-inheritance-iii/main.js:7
class Nurse extends HospitalEmployee {
^^^^^
This has happened to me before, where even copying from the example and pasting into the console produces an error. I tried with a different browser, but got the same result.
Anyone know why, please?

If you have an error at the start of a line, checking the line(s) above.

for example when you forgot to close a bracket (can either be: ) or }), so difficult to say without seeing the full code

Every time this error has occured, it was when I hadn’t toucheed the code that was already present in main.js, I just added a line of valid code. A couple of times, even asking for the solution didn’t fix it; codecamy’s bot completed the assignment by filling main.js with the correct code, but js.lint would still parse it as invalid and throw an error.
Here’s the contents ofmain.js:

class HospitalEmployee {

  constructor(name) {

    this._name = name;

    this._remainingVacationDays = 20;

  }

 

 class Nurse extends HospitalEmployee {

  }

  get name() {

    return this._name;

  }

  

  get remainingVacationDays() {

    return this._remainingVacationDays;

  }

  

  takeVacationDays(daysOff) {

    this._remainingVacationDays -= daysOff;

  }

}

You nested your child class within your parent class/in the body of your parent class, why?

Because it says to do exactly that:

“Under HospitalEmployee , create an empty class named Nurse that extends HospitalEmployee .”

in this case under means after. Or the lines under closing the HospitalEmployee class

In programming, analytic and critical thinking is far more important then the code. When you instructions, you should ask yourself: what i am trying to do, and why?

2 Likes

I appreciate the advice, thank you, but I (and probably many other cc users) have a nuerological disorder that causes me to take written instructions very literally (much like a computer!).
In previous assignments, the wording of the instructions specifically said: “At the bottom of main.js add a line that says…”.
Also, the term ‘under’ has meant, in other assignments, to write the line of code under the one indicated.
In the absence of other visual cues, a person like me will refer back to previous word uses in an attempt to clarify the intent, which is analytic and critical thinking. Once again, context is everything.
Your advice is completey correct, and it would be excellent for a nuerotypical student, but people with ADHD or autism (like me), have difficulties with mental problems. When we get stuck, it’s harder to step back and see the problem, we just get locked in to the fact that we are doing what we were told to do and it isn’t working.
Codecademy is an excellent application, but I think that a little more consistency in the wording of the instuctions would save people like me a lot of frustration.
Thank you again.

I get your point, but I don’t think I agree on all of them

People with autism seem very capable of programming. I don’t know if there are stats on this (I hope there are), but I think IT has a relative high percentage of autistic people. Like you said, this applies very possible to more people here on CC.

programming is primarily problem solving, something everyone needs to learn when they are learning to program. Of course, my answer was intended that you instantly become a master problem solver. But its something I wanted to make you aware of.

There is still a lot to learn about autism, but with new theories and models ( like Socioscheme[1] ), which enforces that autistic people might actually be really good problem solvers and analytic thinkers.

and that is what you should take away from this exercise (more then anything): Think about what you are doing and why. Be analytic, use that as your strength

where you need to go in the end is this: a client wants an app, which have certain requirements and features. Then there are no instructions at all.

of course, this is not the level you need for your first junior/entry level job. Then you are guided a bit more, and you start with small bug fix or a small feature.

[1] Unravelling Autism: Introduction to Autism with the Socioscheme F Delfos Martine

I wasn’t suggesting that your advice was in any way flawed, or not applicable to people like me. Like I said; the advice was correct, full stop. I aslo was not suggesting that people wth ASD don’t make good programmers, on the contrary. It is specifically because of the disorder that ASD sufferers are great at problem solving (and yes, there is a high prevalence of nuerological disorders in the IT community, and stats are starting to emerge), and here is where the computer analogy applies again, because analytical thinking requires following logical structures; classifying items into specific, corroborable sections and identifying similarities between them, which means rules, just like the instructions of an algorithm. Problem solving is just breaking the problem down into its constituent parts, and then solving each small problem in order of complexity. The difficulty with thinking very logically though, is that like a computer, an ambigous or inconsistent instruction can send the problem solver in to a loop, or even a crash (like personal meltdowns).

A person can learn to cope with a neurological disorder, but it doesn’t go away with practice, as you seem to be sugesting.
Also, the requirements provided by a client for an app are not analogous to the logical obstacles encountered in writing the code for one. I work best with no instructions at all, just a set of requirements. It is when a neurotypical person provides precise instructions that I have trouble, because they think that what they are saying can only have one possible inerpretation, and that the interpretation will be obvious to all, but being very logical, I follow instructions exactly as they are written, and this way of thinking is a product of the relationship between the different parts of the brain being different to that a neurotypical person (hence the term ‘neurological disorder’), and it is not something that is as simply resolved as just looking at the problem more objectively.

I still appreciate your help, but the solution to ensuring that a learning platform is as equally accesible to those with a learning difficulty as it to those without is to design it with that goal in mind (like using consistent wording), and not just expecting the user with the learning difficulty to learn to think like other people, because if it were that easy then being intelligent people, we would have learned to do that long ago.

i do absolutely not suggest such a thing. I was merely saying all human beings need practice in problem solving skill if they want to become decent/good developer. Programming is problem solving and analytical foremost. Something everyone can get better at with practice.

no way this can ever be achieved.

And its missing the point completely I gave in my advice. This is the last I will say about it

Why not? You MUST use consistent wording when talking to a <i.machine, or you get a syntax error. Why is it unrealistic to expect the person writing the instructions to the learner to apply the same level of attention to what they are telling to a person as to what they are telling to a computer? One would just have to remember to use the same words for the same instruction each time.

Precisely for the reason you mention. Talking to a machine (a piece of rock) is not the same as talking to a human being. A programming language only understands a limited set of things, while a natural language like English is a lot more complex.

Furthermore, humans wrote those courses, very likely different people. Or content got updated by someone else then the original creator. You can’t expect all the humans to express themselves in exactly the same way. And to pour over everything everybody else wrote is simple you something don’t have time for (deadlines, cost). All the courses offered by codecademy also needs validation. People get promoted, fired, quit and so forth.

so now we have determined humans and organizations aren’t perfect (they can’t be), could we put the focus on that its a better idea to start thinking for one-self?

When instructions are presented, to think about: Why do I do this? And why? what does this matter for program? Where should this code be placed? And so forth.

Asking yourself these kind of questions will result in less frustration and much better coping. And it will make you a better programmer/developer.

The page gave me a specific instruction to do something that would cause an error, because the person who wrote it didn’t take enough time to consider how that sentence could be interpreted.

Noone needs to read everything that was already written, they just need to think about what they’re writing. We are here to learn to code, not learn alternative interpretations of English literature, or lessons of life’s inconsistent nature. We are not discussing a logic problem, or a problem I had with javascript. The problem is with the ambiguous wording of the instruction, which is the responsobiity of the site, not the student.