Learn how to create a travel function with JavaScript using prompt, if and else statement and alert.
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!");
}
How do you create a variable in Javascript?
what does the "return" do?
What is console.log
what are callback functions?
how to remove an item from an array
what does it mean to return something in javascript
Functions In Javascript
What is an arrow function and what is an example?
setInterval() explain this
what do the values "null" and undefined mean in js?
what is a parameter
How to remove items from an array in JS
what is the different between const and var and Iet in javascript
What is a ternary expression and what is an example?
let vs var
how to add an extra property to an object
what is an api
what is the difference between argument and parameter?
What is nodejs
How to use push() in JavaScript
how to use assign()
how to console log
difference between let and const in javascript?
what is const
Remove Monday and Tuesday // Log the array
What is jquery?
how to use template literals
remove element from array
How to set 2 conditions in a "if statement" in javascript?
Which JavaScript method converts JSON to a JavaScript value?
what is const?
how to use the math round method
let weather = { paris: { temp: 19.7, humidity: 80 }, tokyo: { temp: 17.3, humidity: 50 }, lisbon: { temp: 30.2, humidity: 20 }, "san francisco": { temp: 20.9, humidity: 100 }, oslo: { temp: -5, humidity: 20 } }; // write your code here let roundedWeather = {}; for (let city in weather) { roundedWeather[city] = {}; roundedWeather[city].temp = Math.ceil(weather[city].temp); roundedWeather[city].humidity = Math.ceil(weather[city].humidity); } console.log(roundedWeather); let city = prompt("Enter a city"); if (weather[city] !== undefined) { city = city.toLowerCase(); alert( `It is currently ${roundedWeather[city].temp}Β°C in ${city} with a humidity of ${roundedWeather[city].humidity}%` ); } else { alert( `Sorry we don't know the weather for this city, try going to https://www.google.com/search?q=weather+${[ city ]}` ); }
what is functional programming
explain a JavaScript switch statment
What is package.json?
how do i add a new property to an existing object in javascript?
removing an item on array
what is a spread operator in javascript
what does eval() in JS mean
how to write a comment in java script
difference between == and ===
How do you map the array values without using map method
How can I make time in milliseconds to be updated in real time and in UTC
how to convert array to string using loops js
what is const in js
can you explain for in javascript, please
What is an if statement?
what is indexOf() in javascript
difference between for loop and map method