Prompts are like Alerts: var person = prompt("What is your name?", "Your Name"); // Arguments are always strings
if (x === correctAnswer) {} // tripple equal sign
!== // does not equal to smth
if (x === "Vatican") { alert("Correct!"); } else if (x==="Rome") { alert("Incorrect but close" } else{ alert("Incorrect") }
You can Chain any number of conditions together: if (weight > 300 && time < 6 && age>17 && gender ==="male") {}
if ( SAT>avg || GPA > 2.5 || sport ==="football"){ alert("Welcome")} else {} // If any of the given arguments is correct, the code inside the curly brackets is executed
ADD PARANTHESES IF YOU ARE GIVING A LOT OF ARGUMENTS AS IF IT IS MATH
ARRAYS: var cities = ["Atlanta", "Baltimore", "Chicago", "Denver", "Los Angeles"] alert("Welcome to " + cities[0]); // prints Welcome to Atlanta
ADDING ELEMENTS TO AN ARRAY: var cities = []; cities[0]= "Atlanta"; cities[0]="LA"; // And that is how you can replace elements cities.pop(); // Removes tha last element cities.push("Tashkent, "Termez"); // Add one or more elements to the END of the array cities.shift(); // removes and element from the beginning cities.unshift("Tashkent", "New York") // Adds two(or more ) to the beginning of an array cities.splice(