Ultra beginner here. I'm trying to use conditionals to channel a response for a mini chatbot program.
let counter = 0;
note: counter is going to be increased by form submit action.
function router(){
let input = getInput();
var blah1 = respArr1[(Math.floor(Math.random))*respArr1.length];
var blah2 = respArr2[(Math.floor(Math.random))*respArr2.length];
var blah3 = respArr3[(Math.floor(Math.random))*respArr3.length];
if(counter === 1){
for(let i=0; i<input.length; i++){
if(input[i].includes(userArr0){
return blah1;}
}
}
return blah2;
if(counter === 2){
return blah3;
if(counter > 2){
return talkAt();
}
}
}
I keep getting an "Unexpected token: {" error on the conditional
if(input[i].includes(userArr0){
I'm sure there's more than one thing wrong with this code. I'm trying to learn very quickly and probably making a lot of dumb mistakes.
Any help appreciated. Thanks!
Aucun commentaire:
Enregistrer un commentaire