[JavaScript] - Understanding JavaScript Functions and If | SheCodes

[JavaScript] - Understanding JavaScript Functions and If Statements

Learn how to create a travel function with JavaScript using prompt, if and else statement and alert.

πŸ‘©β€πŸ’» Code to be fixed

     function travel() {
        let name = prompt("What is your name?");
        let email = prompt("What is your email?");
        let travel = prompt("Do you enjoy traveling?");

        if (travel = "yes") {
        alert("Thank you " + name + "! I'll be in touch via email 😁");
      }
        else (travel !== "yes") 
        alert("Thank you" + name + "! we won't bother you with emails at the moment, but if you change your mind, let us know!");
        }

More coding questions about JavaScript

πŸ‘©β€πŸ’» Technical question

how to round down using javascript

πŸ‘©β€πŸ’» Technical question

how to round up using javascript

πŸ‘©β€πŸ’» Technical question

What is the difference between undefined and null in JavaScript?

πŸ‘©β€πŸ’» Technical question

what is a console.log?

πŸ‘©β€πŸ’» Technical question

Can you explain JS functions return to me?

πŸ‘©β€πŸ’» Technical question

can you explain switch statements in javascript

πŸ‘©β€πŸ’» Technical question

How do I declare an array in JavaScript?

πŸ‘©β€πŸ’» Technical question

what is .join method in javascript

πŸ‘©β€πŸ’» Technical question

What is the purpose of using the let keyword in JavaScript?

πŸ‘©β€πŸ’» Technical question

what is the difference between let and const

πŸ‘©β€πŸ’» Technical question

What is a recursive function?

πŸ‘©β€πŸ’» Technical question

how do you get the system to ignore spaces in the response to a prompt question js

πŸ‘©β€πŸ’» Technical question

What character defines or gives access to jQuery?

πŸ‘©β€πŸ’» Technical question

how to comment on javascript

πŸ‘©β€πŸ’» Technical question

what is var in javescript?

πŸ‘©β€πŸ’» Technical question

what is a trim in javascript

πŸ‘©β€πŸ’» Technical question

What is a Template literal

πŸ‘©β€πŸ’» Technical question

How do you declare objects in JavaScript?

πŸ‘©β€πŸ’» Technical question

what is js math?

πŸ‘©β€πŸ’» Technical question

what is template literals?

πŸ‘©β€πŸ’» Technical question

what is the difference between == and ===? in javascript

πŸ‘©β€πŸ’» Technical question

what is "Identifier has already been declared" ?

πŸ‘©β€πŸ’» Technical question

When the button is clicked, replace button label by β€˜18 degrees’

πŸ‘©β€πŸ’» Technical question

how To display a phone number card when pressing an icon

πŸ‘©β€πŸ’» Technical question

what is cache expire date 10368000 ?

πŸ‘©β€πŸ’» Technical question

JavaScript functions

πŸ‘©β€πŸ’» Technical question

how to declare a function in javascript

πŸ‘©β€πŸ’» Technical question

what is the main use of filter method in js

πŸ‘©β€πŸ’» Technical question

How do I use backtick in javascript

πŸ‘©β€πŸ’» Technical question

what is hasOwnProperty in js

πŸ‘©β€πŸ’» Technical question

What is await in js

πŸ‘©β€πŸ’» Technical question

what is .toLowerCase()

πŸ‘©β€πŸ’» Technical question

what does .reduce() do?

πŸ‘©β€πŸ’» Technical question

explain toFixed method in javascript

πŸ‘©β€πŸ’» Technical question

how to acces to an object property inside an object

πŸ‘©β€πŸ’» Technical question

What is the infinity global property in Javascript and when is it used?

πŸ‘©β€πŸ’» HTML, CSS and JavaScript Code instructions

// Question: // Create a function that takes a string as a parameter // and alternates the casing of each individual letter // within the string. // Eg. Hello World! => hELLO wORLD!

πŸ‘©β€πŸ’» Technical question

what is a javascript function

πŸ‘©β€πŸ’» Technical question

what is forEach in javascript?

πŸ‘©β€πŸ’» Technical question

what is axios?

πŸ‘©β€πŸ’» Technical question

What is a comment in JavaScript?

πŸ‘©β€πŸ’» Technical question

how can I link my javascript file to a separate HTML file?

πŸ‘©β€πŸ’» Technical question

How to append the header to a html table in javascript?

πŸ‘©β€πŸ’» Technical question

how to get matching data from a prompt on an existing object

πŸ‘©β€πŸ’» Technical question

what are arguments in a function? Like what's a function that takes 2 arguments, name and email, look like?

πŸ‘©β€πŸ’» Technical question

can you nest objects javascript

πŸ‘©β€πŸ’» Technical question

What is the difference between setTimeout and setInterval?

πŸ‘©β€πŸ’» Technical question

Can you use forEach with an array of objects?

πŸ‘©β€πŸ’» Technical question

what are data types