Argument isn't passing

class bulborb{

          this.habitat = habitat
          this.color = color
 = name



          this.color = Changecolor




class redbulborb extends bulborb{

    constructor(name,habitat, color){




class whitebulborb extends bulborb{

    constructor(name, habitat, color){

        super(name, habitat, color)  



let Redbulborb = new redbulborb("RedBulborb","Surface", "Red")
let Whitebulborb = new whitebulborb("Whitebulborb","Cave", "white")


When I was tryna switch the Redbulborb’s color to “Pink”, the console says:class.js:472 Uncaught ReferenceError: Cannot access ‘Redbulborb’ before initialization
at class.js:472:1

I double checked my syntax and still doesn’t work.

The problem is that this:

let Redbulborb = new redbulborb("RedBulborb","Surface", "Red")

has to come before this:


This is basically the same issue as here: Why can't we use function variables

1 Like

It had been like that, and it still doesn’t work

What are you expecting to happen?

This works as expected.

class bulborb {
  constructor(name, habitat, color) {
    this.habitat = habitat;
    this.color = color; = name;

  bulborbscream() {
    console.log(, 'Raaaaache');

  changecolor(Changecolor) {
    this.color = Changecolor;

class redbulborb extends bulborb {
  constructor(name, habitat, color) {
    super(name, habitat, color);

  bulborb() {

let Redbulborb = new redbulborb('RedBulborb', 'Surface', 'Red');



Object { habitat: "Surface", color: "Red", name: "RedBulborb" }
Object { habitat: "Surface", color: "Pink", name: "RedBulborb" }

As an aside, I would really recommend that you start following some of the conventions that have been pointed out to you in your other threads. I’m not going to keep repeating the same advice, but if you are interested I could summarize a couple of things you could improve here.

It works now. I forgot that my computer went to sleep, so it froze my website. so it has been working. gg

I would like you to do that.

Sure :slight_smile:

This will give you:

class Monster {
  constructor(name, habitat, color) {
    this.habitat = habitat;
    this.color = color; = name;

  scream() {
    console.log(`${} goes Raaaaache!!!`);

  changeColor(newColor) {
    this.color = newColor;

const redMonster = new Monster('RedBulborb', 'surface', 'red');




I’m confused about eslint.

I did the instructions, and it pops up this in terminal. but prettier works, but the dude to whom you linked me, says I don’t need prettier? and just eslint.


@Growly An alternative here which works in very much the same way standardJS

I have just tested this on a fresh install of vscode.

There is no prettier installed at this point, just the standardJS extension.

You can find and install ‘StandardJS - JavaScript Standard Style’, from the extensions window (ctrl+shift+x)

Note: The version is 2.1.0 not the StandardJS - JavaScript Standard Style (old version)

Next step is editing settings.json

This is my settings.json file

    // Prevents VS Code from formatting JavaScript with the default linter
    "javascript.format.enable": false,
    // Prevents VS Code linting JavaScript with the default linter
    "javascript.validate.enable": false,
    // Lints with Standard JS
    "standard.enable": true,

    // StandardX engine
    "standard.engine": "standardx",
    // Format files with Standard whenever you save the file
    "standard.autoFixOnSave": true,
    // Files to validate with Standard JS
    "standard.validate": [

Note: You will want to merge/overwrite these setting with your existing settings.

You will see I have selected standardx as my engine "standard.engine": "standardx". I like this option as it is can be customised e.g. allowing spacing between lines, setting tab widths etc. For now though, no need to worry about that!

You need to install standardx. You can install it globally, but I like to install it on a per project basis.

So with your chosen folder open in vscode, you will want to open a terminal from the top menus Terminal → New Terminal (ctrl+shift+')

Then in the terminal window install standardx like so.

npm install standardx --save-dev

You should now be good to go. (if not, you can try closing and re-opening vscode)

It is set to fix on save (ctrl+s).

So for example on pasting your code into a new javascript file, I press ctrl+s to save. This will do the formatting, fixing indents etc.

Sometimes it is an idea to do this again as it will fix a few other small issues e.g. gaps between parameters in functions, gaps between a function and it’s parentheses
function(x,y) -> function (x, y) etc

The next stage is to hover over the remaining red squiggly lines and follow the instructions.

It not only helps you fix issues and format your code properly, but it also makes for a great learning tool.

said the same thing as Eslint.


@Growly Have you installed Node?

Sorry, but kind of took that one for granted :slight_smile:

You can follow the first 1.40 minutes of this video for a guide on installation, it’s a recent one.

I havent

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