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.