commente le spam dans la console
This commit is contained in:
parent
68415619cc
commit
7e7d8d6504
1 changed files with 9 additions and 11 deletions
20
js/main.js
20
js/main.js
|
@ -64,17 +64,17 @@ const parseLogicalExpression = (subject = Object, expression = String) => {
|
|||
const gate = (gate = String, array = Array) => {
|
||||
let posGate = array.findIndex(element => typeof element == "string")
|
||||
if(array[posGate] == gate) {
|
||||
console.log("je vais travailler avec la porte", gate, "sur", array);
|
||||
console.log("je fais,", array[posGate - 1], gate, array[posGate + 1])
|
||||
if(gate == "&&") array[posGate + 1] = array[posGate - 1] && array[posGate + 1];
|
||||
// console.log("je vais travailler avec la porte", gate, "sur", array);
|
||||
// console.log("je fais,", array[posGate - 1], gate, array[posGate + 1])
|
||||
if(gate == "&&") array[posGate + 1] = array[posGate - 1] && array[posGate + 1];
|
||||
else if(gate == "||") array[posGate + 1] = array[posGate - 1] || array[posGate + 1];
|
||||
else return console.error("bad gate type");
|
||||
console.log("res:", array[posGate + 1]);
|
||||
// console.log("res:", array[posGate + 1]);
|
||||
array.splice(posGate - 1, 2);
|
||||
console.log("finit:", array);
|
||||
} else console.warn("la porte", gate, "n'a pas la priorité de calcule", array);
|
||||
// console.log("finit:", array);
|
||||
} // else console.warn("la porte", gate, "n'a pas la priorité de calcule", array);
|
||||
|
||||
console.log("\n ");
|
||||
// console.log("\n ");
|
||||
return array;
|
||||
};
|
||||
|
||||
|
@ -106,19 +106,17 @@ const parseLogicalExpression = (subject = Object, expression = String) => {
|
|||
// -> on retire les string vide
|
||||
arrayLogicalExpression = arrayLogicalExpression.filter(element => element != "");
|
||||
|
||||
console.log(arrayLogicalExpression);
|
||||
// console.log(arrayLogicalExpression);
|
||||
|
||||
// on remplace par les valeurs de subject
|
||||
replaceWithRightValues(subject, arrayLogicalExpression);
|
||||
|
||||
// on supprime les parenthèses
|
||||
console.log("avant bracket calculator:", arrayLogicalExpression);
|
||||
arrayLogicalExpression = bracketCalculator(arrayLogicalExpression);
|
||||
console.log("apres bracket calculator:", arrayLogicalExpression);
|
||||
|
||||
// on résoud les problemes
|
||||
resolution(arrayLogicalExpression);
|
||||
|
||||
console.log("resultat final:", arrayLogicalExpression);
|
||||
// onsole.log("resultat final:", arrayLogicalExpression);
|
||||
return arrayLogicalExpression[0];
|
||||
};
|
||||
|
|
Reference in a new issue