Hello everyone.
this the all of the code and, gonna add the error at the bottom .
if you can spot the mistake please let me know.
thank you!
const prompt = require ('prompt-sync') ();
const ROWS = 3;
const COLS = 3;
const SYMBOLS_COUNT = {
A: 2,
B: 4,
C: 6,
D: 8,
}
const SYMBOLS_VALUES = {
A: 5,
B: 4,
C: 3,
D: 2,
}
const deposit = () => {
while(true) {
const depositAmount = prompt ('Enter a deposit amount: ');
const numberDepositAmount = parseFloat (depositAmount);
if (isNaN(numberDepositAmount) || numberDepositAmount <= 0) {
console.log('Invalid deposit amount, try again.')
}else {
return numberDepositAmount;
}
}
};
const getNumberOfLines = () => {
while(true) {
const lines = prompt ('Enter the numbers of lines to bet on (1-3): ');
const numberOfLines = parseFloat (lines);
if (isNaN(numberOfLines) || numberOfLines<= 0 || numberOfLines > 3) {
console.log('Invalid number of lines, try again.')
}else {
return numberOfLines;
}
}
};
const getBet = (balance, lines) => {
while(true) {
const bet = prompt ('Enter the bet per line: ');
const numberBet = parseFloat (bet);
if (isNaN(numberBet) || numberBet <= 0 || numberBet > balance / lines) {
console.log('Invalid bet, try again.')
}else {
return numberBet;
}
}
};
const spin = () => {
const symbols = [];
for (const [symbol, count] of object.entries(SYMBOLS_COUNT)) {
console.log(symbol, count);
}
};
spin ();
let balance = deposit();
const numberOfLines = getNumberOfLines();
const bet = getBet(balance, numberOfLines);
the error goes like this:
JavaScript Projects % node project.js
/Users/Documents/Developer/JavaScript Projects/project.js:71
for (const [symbol, count] of object.entries(SYMBOLS_COUNT)) {
^
ReferenceError: object is not defined
at spin (/Users//Documents/Developer/JavaScript Projects/project.js:71:46)
at Object.<anonymous> (/Users//Documents/Developer/JavaScript Projects/project.js:76:5)
at Module._compile (node:internal/modules/cjs/loader:1233:14)
at Module._extensions..js (node:internal/modules/cjs/loader:1287:10)
at Module.load (node:internal/modules/cjs/loader:1091:32)
at Module._load (node:internal/modules/cjs/loader:938:12)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:83:12)
at node:internal/main/run_main_module:23:47