Own Code 13/13 please check what I did wrong?




You need to paste in your code as each learners lesson is private so we cannot see your code


var ja = ["Ja", "ja"];
var nein = ["Nein", "nein"]

var weiter = prompt("Bist Du bereit für mein kleines selbstgeschriebens Abenteuer? :)");

if(weiter <= ja.length) {
console.log("Dann beginnt die Geschichte des Spiels!");
console.log("Du wachst auf in einem Wald, es ist Nacht und Du siehst kaum Deine eigenen Hände, so dunkel ist es. Es ist soo dunkel, das Du nicht einmal den Baum sieh...'Autsch', das dürfte wehgetan haben! Es ist sehr dunkel.");
var dunkel = prompt("Findest Du auch das es Dunkel ist?");
else if(weiter === nein[1,2]) {
confirm("Dann musst Du leider gehen");
else {
console.log("Bist Du sicher das diese Möglichkeit zur Auswahl stand?");


What error are you getting?


It's just not going the way I wanted it to.

It directs me to the last console.log even if the Answer to first prompt is one of the 4 given variables.


you mean that it prints the else statement?


Yes exactly. But why doesnt it first check the if?


as i see it, unless you write more than 2 letters on your first prompt, the logic will follow else.


plus, if you want your "else if" statement to be true, then it is not right to write
else if (weiter === nein[1,2])
it should be:
else if(weiter=nein[0,1])


I am trying to get a confirmation within my code if the speed exceeds 65. The code is running but it is ignoring the first if statement and just assuming the "else" outcome of "You are being a safe driver.

var speed = function (distance,time) {
return distance / time
if (speed > 65) {
var q = confirm("Are you sure you want to drive that fast?");
if (q === 1) {
console.log("I hope you get a ticket!");
else {
console.log("You are better off slowing down.");
else {
console.log("You are being a safe driver.");


speed is the name of your function and function > number makes no sense which mostly results in unexpected results or errors. Here it seems to be false so you go directly to the else case.


Thank you I went over it and figured it out. I appreciate it.