Ongoing issues with main.js

Hi,

Not sure if other people who are taking the JavaScript course with me are having the same issues but the issue I am having with main.js has really started to become tiresome for a service I paid for so I feel like i am not getting back anymore…
While moving over the tasks main.js almost never puts a check mark on my answer once it is corrected and keeps giving the same old error. This results in not being able to move forward in the subject and and have to replace the solution where I can´t get to learn how other steps are done on my own. This issue wasn´t there before and started from Promises chapter and still goes on.
Before coming here I reported under “Bugs” within the course itself many times but looks like nothing is being really fixed. On top of this I keep getting bugs in the “View Solution” page like “Keep my code” button not working so I need to refresh the page and do it all over again…
I really like this course but I am just so tired of bumping on the same issue all the time.
I have an incomplete subject just because of this issue that i previously mentioned in the forum and still couldn´t get an answer to for over months.
This will result in me not being able to finalise the course cause it won´t be a 100% progress since I had to skip that subject.
When I apply for a job or sth I would want to show a course that is completed 100% and not have to make this painful explanation of why it is not 100%.

Thank you!
Pelin.

Hi! Are you referring to this post?

We need more details so we can try to help you. What is the error you are seeing constantly? Is it still on page 6/11 on Promises? The one with tittle The onFulfilled and onRejected Functions ?

It will be very helpful if you can share the code you are using and the error message you are getting. You can read here How Do I Format My Post? if you need help formatting.

Hope to hear from you soon! :smiley:

No, that is resolved.
I was referring to the one here I entered in November:

Here is the link:

That I believe has the same issue, you can see similar posts under the subject.

I am currently on the lesson Requests II and same thing is happening. Would be great if you can have a look.

Let me know if you need further details.

The topic you replied to does not seem related to the exercise you work on. Making a new topic with:

  1. your code
  2. the exercise url
  3. error

will very likely get you better help faster

as for you issue, look at your class:

class HospitalEmployee {
  constructor(name) {
    this._name = name;
    this._remainingVacationDays = 20;
    
}
  } // closes the class

the getters are not part of the class, which results in a syntax error.

Because it is not about any topic but how exercise steps next to it is giving unnecessary errors whereas my answer is correct, I will send you some screnshots tomorrow.

Pelin.

I meant the topic you linked to, the FAQ browser compatibility one

you simply have a syntax error. The code I saw was not correct.

Exactly, that code part was given by default by Codecademy so I didn´t write it. I just copy/pasted the whole code to an online JavaScript editor and it was already giving error as I mentiond in my message. So guess that was why it wasn´t working eventhough I did all steps correctly. Can you please correct the main.js in that lesson so I can move forward?

Here: https://www.codecademy.com/courses/introduction-to-javascript/projects/transpilation

There you´ll see I am only creating package.json files or .babelrc to check the ES5 and ES6 syntax difference. Not touching anything in main.js…

I have also an ongoing issue with the Requests II lesson, when I write the below code in Step 4 it gave an error:

const endpoint = `${url}${queryParams}${wordQuery}`;

It gives error if I put spaces either:

const endpoint = `${url} ${queryParams} ${wordQuery}`;

In the solution I check, the answer is the same…

Here you can check:
https://www.codecademy.com/courses/introduction-to-javascript/lessons/requests-ii/exercises/fetch-get-requests-iii

If I do a reset I get different code:

class HospitalEmployee {
  constructor(name) {
    this._name = name;
    this._remainingVacationDays = 20;
  }
  
  get name() {
    return this._name;
  }
  
  get remainingVacationDays() {
    return this._remainingVacationDays;
  }
  
  takeVacationDays(daysOff) {
    this._remainingVacationDays -= daysOff;
  }
  
  static generatePassword() {
    return Math.floor(Math.random()*10000);
  }
}

class Nurse extends HospitalEmployee {
  constructor(name, certifications) {
    super(name);
    this._certifications = certifications;
  } 
  
  get certifications() {
    return this._certifications;
  }
  
  addCertification(newCertification) {
    this.certifications.push(newCertification);
  }
}

const nurseOlynyk = new Nurse('Olynyk', ['Trauma','Pediatrics']);
let nurseDurant = new Nurse('Durant', ['Orthopedics']);
nurseOlynyk.takeVacationDays(5);
console.log(nurseOlynyk.remainingVacationDays);
nurseOlynyk.addCertification('Genetics');
console.log(nurseOlynyk.certifications);

module.exports = HospitalEmployee;

I have no idea what you did. But learning to debug code is part of the process. Or you can reset, to get the original code.

We can log the endpoint:

  const endpoint = `${url}${queryParams}${wordQuery}`;
  console.log(endpoint);

which looks fine. So difficult to say what is wrong, please post your full code

As I said this was the given code, if you check the same Topic you’ll see similar issues being stated by other people.
And debugging main.js is not that subject’s goal so only consuming my time.

I will put your code and try with it, hope that will work. Have you checkedi f it works?

Pelin.

Here:

// Information to reach API
const url = '[https://api.datamuse.com/words](https://api.datamuse.com/words)'

const queryParams = '?sl='

// Selects page elements
const inputField = document.querySelector('#input');
const submit = document.querySelector('#submit');
const responseField = document.querySelector('#responseField');

// AJAX function
const getSuggestions = () => {
const wordQuery = inputField.value
const endpoint = `${url} ${queryParams} ${wordQuery}`;
fetch(endpoint, cache: 'no-cache' )
}

// Clears previous results and display results to webpage
const displaySuggestions = (event) => {
event.preventDefault();
while(responseField.firstChild){
responseField.removeChild(responseField.firstChild);
}
getSuggestions();
};

submit.addEventListener('click', displaySuggestions);

no, but at least it does not contain the mistake I spotted in your code. Debugging is part of programming, your own code or someone else. Doesn’t matter

Please see here:

[How-to] Create a topic that everyone will read

you need to post code with format, otherwise the forum messes up the url and other things.

Maybe the code was updated since I wrote that message months ago…
And trying to fix a code that is totally irrelevant with the subject I am learning is only time consuming and not a good strategy, take this as a feedback from a client.

Find the screenshots of the code attached in an order of: 1-2-3 where you can see formatting as it is…

I do not work from screenshots, then find someone else to help you. Just read the topic I provided to format your code, will only take two minutes