Need help!


#1

this is my code:

var user = prompt("What front end development skills do you have? Choose from the following list:HTML, CSS, JS, PHP").toLowerCase();
switch(user) {
    case "html":
        console.log("You know the structure of a web page, the standard for structuring and presenting content on the World Wide Web.");
        var knowHtml = prompt("Do you have advanced knowledge? YES / NO").toLowerCase();
        var know2ormoreskills = prompt("Do you know another skill? YES / NO");
        if(knowHtml === yes && know2ormoreskills === yes) {
            console.log("Great, you are hired!");
        }
        return "Try again after 2-3 years!"
        break;
    case "css":
        console.log("Cascading Style Sheets, fondly referred to as CSS, is a simple design language intended to simplify the process of making web pages presentable. So you know how to organise and how to style the elements in the page");
        var knowCss = prompt("Do you have advanced knowledge? Yes / No").toLowerCase();
        var know2ormoreskills = prompt("Do you know another skill? YES / NO").toLowerCase();
        if(knowCss === yes && know2ormoreskills === yes) {
            console.log("Sounds interesting!");
        }
        return "Go home!"
        break;
    case "js":
        console.log("JavaScript is a lightweight, interpreted programming language with object-oriented capabilities that allows you to build interactivity into otherwise static HTML pages.");
        var knowJs = prompt("Do you have at least 1-2 years experience with caMel CaSe JS? YeS/nO").toLowerCase();
        var know2ormoreskills = prompt("Do you know another skill? YES / NO").toLowerCase();
        if(knowJs === yes || know2ormoreskills === yes) {
            console.log("Maybe, I will hire you!Keep close to your phone, in the very next day I'll call you!");
        }
        return "You must struggle to get a job!"
        break;
    case "php":
        console.log("PHP is a recursive acronym for 'PHP: Hypertext Preprocessor'. PHP is a server side scripting language that is embedded in HTML. It is used to manage dynamic content, databases, session tracking, even build entire e-commerce sites.");
        var knowPhp = prompt("Do you have at least 3-5 years experience with PHP? yes/ no").toLowerCase();
        if(knowPhp === yes) {
            return "Go to hell!";
        }
        return "It's allright. You don't have to have so much years in a programming language";
        break;
    default:
        console.log("You must choice at least one skill from the list!");
}

#2

@neagumihai54321gmail

for all your things that have === yes you need to make yes into a string so "yes"

Thats ll I've noticed so far, not sure if swapping between return and console.log affects things...

Try changing all your returns into console.log also.


#3

I changed it a little bit to not return anything:

var user = prompt("What front end development skills do you have? Choose from the following list:HTML, CSS, JS, PHP").toLowerCase();
switch(user) {
    case "html":
        console.log("You know the structure of a web page, the standard for structuring and presenting content on the World Wide Web.");
        var knowHtml = prompt("Do you have advanced knowledge? YES / NO").toLowerCase();
        var know2ormoreskills = prompt("Do you know another skill? YES / NO");
        if(knowHtml === yes && know2ormoreskills === yes) {
            console.log("Great, you are hired!");
        }
        console.log("Try again after 2-3 years!");
        break;
    case "css":
        console.log("Cascading Style Sheets, fondly referred to as CSS, is a simple design language intended to simplify the process of making web pages presentable. So you know how to organise and how to style the elements in the page");
        var knowCss = prompt("Do you have advanced knowledge? Yes / No").toLowerCase();
        var know2ormoreskills = prompt("Do you know another skill? YES / NO").toLowerCase();
        if(knowCss === yes && know2ormoreskills === yes) {
            console.log("Sounds interesting!");
        }
        console.log("Go home!");
        break;
    case "js":
        console.log("JavaScript is a lightweight, interpreted programming language with object-oriented capabilities that allows you to build interactivity into otherwise static HTML pages.");
        var knowJs = prompt("Do you have at least 1-2 years experience with caMel CaSe JS? YeS/nO").toLowerCase();
        var know2ormoreskills = prompt("Do you know another skill? YES / NO").toLowerCase();
        if(knowJs === yes || know2ormoreskills === yes) {
            console.log("Maybe, I will hire you!Keep close to your phone, in the very next day I'll call you!");
        }
        console.log("You must struggle to get a job!");
        break;
    case "php":
        console.log("PHP is a recursive acronym for 'PHP: Hypertext Preprocessor'. PHP is a server side scripting language that is embedded in HTML. It is used to manage dynamic content, databases, session tracking, even build entire e-commerce sites.");
        var knowPhp = prompt("Do you have at least 3-5 years experience with PHP? yes/ no").toLowerCase();
        if(knowPhp === yes) {
            console.log("Go to hell!");
        }
        console.log("It's allright. You don't have to have so much years in a programming language");
        break;
    default:
        console.log("You must choice at least one skill from the list!");
}

Just not working!


#4

Your 'yes' represents nothing inside your 'if'. You should compare what's stored inside 'know[language]' and know2ormoreskills variables with a string 'yes'.

So:
How it is: knowHtml === yes
How it should be: knowHtml === 'yes'


#5

thx I see now why is so buggy


#6

Hmm..this checkpoint sucks.
You are not allowed to use ternary operator.


#7

Make all your yes's after a === into a string

KnowCss === "yes" look. yes is between " " because it needs to be a string. yes without " " is not a string and is undefined.

you need to make all the yes after === into strings


#8

thx I know I changed all

var user = prompt("What front end development skills do you have? Choose from the following list: HTML, CSS, JS, PHP").toLowerCase();
switch(user) {
    case "html":
        console.log("You know the structure of a web page, the standard for structuring and presenting content on the World Wide Web.");
        var knowHtml = prompt("Do you have advanced knowledge? YES / NO").toLowerCase();
        var know2ormoreskills = prompt("Do you know another skill? YES / NO");
        if(knowHtml === "yes" && know2ormoreskills === "yes") {
            console.log("Great, you are hired!");
        } else {
            console.log("Try again after 2-3 years!");
        }
        break;
    case "css":
        console.log("Cascading Style Sheets, fondly referred to as CSS, is a simple design language intended to simplify the process of making web pages presentable. So you know how to organise and how to style the elements in the page");
        var knowCss = prompt("Do you have advanced knowledge? Yes / No").toLowerCase();
        var know2ormoreskills = prompt("Do you know another skill? YES / NO").toLowerCase();
        if(knowCss === "yes" && know2ormoreskills === "yes") {
            console.log("Sounds interesting!");
        } else {
            console.log("Go home!");
        }
        break;
    case "js":
        console.log("JavaScript is a lightweight, interpreted programming language with object-oriented capabilities that allows you to build interactivity into otherwise static HTML pages.");
        var knowJs = prompt("Do you have at least 1-2 years experience with caMel CaSe JS? YeS/nO").toLowerCase();
        var know2ormoreskills = prompt("Do you know another skill? YES / NO").toLowerCase();
        if(knowJs === "yes" || know2ormoreskills === "yes") {
            console.log("Maybe, I will hire you!Keep close to your phone, in the very next day I'll call you!");
        } else {
        console.log("You must struggle to get a job!");
        }
        break;
    case "php":
        console.log("PHP is a recursive acronym for 'PHP: Hypertext Preprocessor'. PHP is a server side scripting language that is embedded in HTML. It is used to manage dynamic content, databases, session tracking, even build entire e-commerce sites.");
        var knowPhp = prompt("Do you have at least 3-5 years experience with PHP? yes/ no").toLowerCase();
        if(knowPhp === "yes") {
            console.log("Go to hell! We are not looking for seniors!");
        } else {
        console.log("It's allright. You don't have to have so much years in a programming language");
        }
        break;
    default:
        console.log("You must choice at least one skill from the list!");
}

#9

Thx to everyone! The version 1.3 of the application is the best because is using another global variable "know2ormoreskills" and is shorting the code story. Thx to everyone to make this possible :smiley:

var user = prompt("What front end development skills do you have? Choose from the following list: HTML, CSS, JS, PHP").toLowerCase();
var know2ormoreskills = prompt("Do you know another skill? YES / NO").toLowerCase();
switch(user) {
    case "html":
        console.log("You know the structure of a web page, the standard for structuring and presenting content on the World Wide Web.");
        var knowHtml = prompt("Do you have advanced knowledge? YES / NO").toLowerCase();
        if(knowHtml === "yes" && know2ormoreskills === "yes") {
            console.log("Great, you are hired!");
        } else {
            console.log("Try again after 2-3 years!");
        }
        break;
    case "css":
        console.log("Cascading Style Sheets, fondly referred to as CSS, is a simple design language intended to simplify the process of making web pages presentable. So you know how to organise and how to style the elements in the page");
        var knowCss = prompt("Do you have advanced knowledge? Yes / No").toLowerCase();
        if(knowCss === "yes" && know2ormoreskills === "yes") {
            console.log("Sounds interesting!");
        } else {
            console.log("Go home!");
        }
        break;
    case "js":
        console.log("JavaScript is a lightweight, interpreted programming language with object-oriented capabilities that allows you to build interactivity into otherwise static HTML pages.");
        var knowJs = prompt("Do you have at least 1-2 years experience with caMel CaSe JS? YeS/nO").toLowerCase();
        if(knowJs === "yes" || know2ormoreskills === "yes") {
            console.log("Maybe, I will hire you!Keep close to your phone, in the very next day I'll call you!");
        } else {
        console.log("You must struggle to get a job!");
        }
        break;
    case "php":
        console.log("PHP is a recursive acronym for 'PHP: Hypertext Preprocessor'. PHP is a server side scripting language that is embedded in HTML. It is used to manage dynamic content, databases, session tracking, even build entire e-commerce sites.");
        var knowPhp = prompt("Do you have at least 3-5 years experience with PHP? yes/ no").toLowerCase();
        if(knowPhp === "yes") {
            console.log("Go to hell! We are not looking for seniors!");
        } else {
        console.log("It's allright. You don't have to have so much years in a programming language");
        }
        break;
    default:
        console.log("You must choice at least one skill from the list!");
}