[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

on a page with just a button, how can I change the color of the whole background? It should be responsive

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

Asked 3 days ago in JavaScript by Sarah-Leigh

Log the number of milliseconds in the current time

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

how to return a random object from an array

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

how to remove duplicate characters in a string

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

how to display the number of milliseconds only the last 3 digits

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

reverse a string

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

how do i show only the first option in the loop through an array?

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

how to sort letters in a string in alphabetical order

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

Asked 5 days ago in JavaScript by Christine

can you explain to me the .map function please

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

Asked 6 days ago in JavaScript by Alejandra

how can i add a class to an element via js selectors?

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

what are objects in JavaScript

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

How to delete an upload in your github

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

Asked 7 days ago in JavaScript by Sarah-Leigh

what is the purpose of using console log in javascript?

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

How to create an array of 3 cities with a few properties and console log each city temperature

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

what is the difference between an object and an array

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

difference between an object and an array

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

how I can make a five minute timer in java script?

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

for each in java script

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

else if in java script

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

str length

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

loop through the str

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

capitalize str

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

append with strings

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

string length in java script

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

string length in JS

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

split () and join() java script

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

how can i use the reverse() and the join() methods together on an array?

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

Asked 10 days ago in JavaScript by Nomthandazo

How can I loop an object in javascript

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

Asked 11 days ago in JavaScript by Amanda Ntumba

how to add two alerts on one prompt in javascript for html

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

what's the not equal comparison operator?

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

what is \r\n

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

how to use ".innerhtml"

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

what is greater sign in javascript?

πŸ‘©β€πŸ’» JavaScript Code instructions

greater than sign in javascript and how to use it

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

what does head mean in the context of git?

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

what's the difference between git fetch and git pull?

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

what's square bracket notation in js?

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

what's DOM?

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

What does textcontent mean in javascript

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

What is the logical AND operator in JavaScript?

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

What does parse float mean in JavaScript

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

what are break statements in javascript

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

what does .push mean ?

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

What does console.log mean in JavaScript?

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

how to use trim in js

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

What is const

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

Math functions in js

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

what does setInterval(() mean?

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

Explain how == and === are different in JavaScript.

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

what is Node.js