Find Your Hat - I don't understand how to use the terminal


This doesn’t run like the other projects (ctrl + enter). I know I need to use ‘node main.js’ to run it. I got a syntax error on my array I declared. However, even after I comment out the array, I still get the syntax error. I have commented out the entire code except 'console.log(‘hello’) and I am still getting the syntax error. Is this a problem on Codecademy’s end or am not using the terminal right?


/*const prompt = require('prompt-sync')({sigint: true});

const name = prompt('What is your name?');

console.log(`Hey there ${name}`);

const hat = '^';

const hole = 'O';

const fieldCharacter = '░';

const pathCharacter = '*';

class Field {

  constructor (myField) {

    this._field = myField;


  printTime () {





const myField = [[░,░,░,░,░,░,░,░], [░,░,░,░,░,░,░,░], [░,░,░,░,░,░,░,░], [░,░,░,░,░,░,░,░], [░,░,░,░,░,░,░,░], [░,░,░,░,░,░,░,░], [░,░,░,░,░,░,░,░], [░,░,░,░,░,░,░,░], [░,░,░,░,░,░,░,░], [░,░,░,░,░,░,░,░]];

//const currentField = new Field(myField);




Terminal with Error:

$ node main.js
const myField = [[░,░,░,░,░,░,░,░], [░,░,░,░,░,░,░,░], [░,░,░,░,░,░,░,░], [░,░,░,░,░,░,░,░], [░,░,░,░,░,░,░,░], [░,░,░,░,░,░,░,░], [░,░,░,░,░,░,░,░], [░,░,░,░,░,░,░,░], [░,░,░,░,░,░,░,░], [░,░,░,░,░,░,░,░]];
SyntaxError: Invalid or unexpected token
    at createScript (vm.js:53:10)
    at Object.runInThisContext (vm.js:95:10)
    at Module._compile (module.js:543:28)
    at Object.Module._extensions..js (module.js:580:10)
    at Module.load (module.js:488:32)
    at tryModuleLoad (module.js:447:12)
    at Function.Module._load (module.js:439:3)
    at Module.runMain (module.js:605:10)
    at run (bootstrap_node.js:427:7)
    at startup (bootstrap_node.js:151:9)

Notice the difference between this:

and this:

1 Like

Ah yes, there is the syntax error. But I think my main concern is, why is the syntax error still showing up if i commented the code out?

My best guess would be that perhaps you didn’t click Save before re-entering the node main.js command.

1 Like

My god, you’re a genius. Thanks. haha