Could someone help me with this code please. I am a begginer


#1

This is the first code that I write and i do not know why in the second if/else when you put something different of yes, it appers you the the response of the yes request.

if ("Jon".length * 2 / (2+1) === 8) {
console.log("The answer makes sense!");
}
else {
console.log("WhatTheFuck???");
console.log("Do you feel OK??");
confirm("Are you sure?")
prompt("Are you OK?")
if ("theRequest === yes") {
console.log("So, you have a problem");
}
else {
console.log("Thanks because if not you have a problem");
}
}

I would appreciate so much if someone could help me. Thanks


#2

The condition you give to your 2nd if/else statement is a text string. I'm guessing you want the condition to read as (theRequest === "yes"). This is assuming theRequest is a variable assigned to a prompt that asks the user to respond "yes". Otherwise, your if statement will evaluate to true and execute the if code.

Is this all of your code? Can you also post a link to the exercise you're working through? There are some issues with your 1st if/else statement as well.


#3

Ok, Thank you so much.
Yes this is my all my code, this is from an execise that I did. I will do another code to begin from the base and then write more lines of code, then if you want I can share by here.

Sincerely Lewis95


#4

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.