I have a variable that basically has 25% chance of being false and a 75% chance of being true. Is there a way I can log an error to the console if it's throwError
is equal to false?
const throwError = Math.random() > 0.25;
if (throwError === true) {
console.log("yay!");
} else {
logError("something went wrong!"); // I expect it to be something like this
}