Challenge Project Number Guesser-help on the terminal

So I am working on this project(https://www.codecademy.com/practice/projects/number-guesser-independent-practice) using my own editor and I am almost done but I am hitting a snag. Here is the code that I was asked to make using Javascript.

script.js:

let humanScore = 0;
let computerScore = 0;
let currentRoundNumber = 1;

// Write your code below:
const generateTarget = () => {
    return Math.floor(Math.random() * 10);
}

const compareGuesses = (humanGuess, computerGuess, targetGuess) => {
    const humanDifference = Math.abs(targetGuess - humanGuess);
    const computerDifference = Math.abs(targetAnswer - computerGuess);
    return humanDifference <= computerDifference;
} 

const updateScore = winner => {
    if (winner === 'human') {
        userScore++;
    } else if (winner === 'computer') {
        computerScore++;
    }
}

const advanceRound = () => currentRoundNumber++;

updateScore('human');
console.log(humanScore);

updateScore('computer');
console.log(computerScore);

Now I go to log it into the terminal using “node.script.js” and it’s not working. it gives me the following:

PS C:\Users\XXXX\Desktop\Important\Codecademy\Projects\number-guesser-starting> node.script.js
node.script.js : The term 'node.script.js' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the 
path is correct and try again.
At line:1 char:1
+ node.script.js
+ ~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (node.script.js:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException
 
PS C:\Users\XXXX\Desktop\Important\Codecademy\Projects\number-guesser-starting> 

Not sure what I am doing wrong. So any help given is very much appreciated. Thank you.

1 Like

Hey there,

You should run the command as “node script.js”.

In yours there is a period between node and script.

Regards,

2 Likes

let humanScore = 0;
let computerScore = 0;
let currentRoundNumber = 1;

// Write your code below:

const generateTarget = function(){
return Math.floor(Math.random()*9);
}

const compareGuess = function (humanGuess, computerGuess,targetGuess){
if((Math.abs( humanGuess - targetGuess )) < (Math.abs(computerGuess - targetGuess))){
return true;
}
else if ((Math.abs( humanGuess - targetGuess )) > (Math.abs(computerGuess - targetGuess)))
return false;
else if((Math.abs( humanGuess - targetGuess )) === (Math.abs(computerGuess - targetGuess))){
return true;
}
else{
return invalid;
}
}

const updateScore = function(){
if(compareGuess){
humanScore + = 1
}
else if(compareGuess === false){
computerScore + = 1
}
currentRoundNumber + = 1
}

runs unexpected token + on humanscore + = 1 line
Can anyone help me with that ?

Try that without the space between + and =
meaning
change + =
to
+=