FullStack JavaScript Learning Blog

April 29, 2022 Test Multiple Conditions with the || “OR” Operator

April 28, 2022 Test Multiple Conditions with the && “AND” Operator
&& AND Operator
( 20 < age && age < 30 )
//Example
> let age = 25;
undefined
> ( 20 < age && age < 30 )
true
Both values must be true
April 27, 2022 Program Multiple Outcomes
if / else if / else review
If one of these is true, it will print the output then escape the if / else clause.
const weather = 'rain';

if ( weather === 'sun') {
console.log("It's sunny, so I'm going swiming");

} else if ( weather === "rain" ) {
console.log("It's raining, so I will read a book.");

} else if ( weather === "snow") {
console.log("It's snowing, so I'm going sledding.");

} else {
console.log("I don't know what I'm doing today");

}
April 27, 2022 Boolean Values.
The + next to guess converted the string guess to a number
if (correctGuess ) works the same way as if (correctGuess === true)
prompt allows a user to enter a number from the webpage
let correctGuess = false;
const number = 6;
const guess = prompt('Guess a number between 1 and 10.')

if ( +guess === number ) {
correctGuess = true;
}

if ( correctGuess ) {
console.log("You guessed the number!");
} else {
console.log(`Sorry. the number was ${number}`);
}
April 7, 2022 JavaScript Basics Introducing Conditional Statements.
I started “Introduction to Conditional Statements” today. It’s a refresher from when I took Java, Advanced Java, Python, and other programming courses in school.
If and Else clode blocks example.
const answer = prompt("Which planet is closest to the sun?");

if ( answer.toUpperCase() === "MERCURY" ) {
console.log("That's correct!");
} else {
console.log("Sorry, that's incorrect.");
}
This code snippet uses the .toUpperCase() function because strings are case sensitive. This function turns all string in a variable to upper case, then it compares to our answer.
March 24, 2022
I’m currently relearning JavaScript Basics.
March 24, 2022
I’m currently learning learning at Treehouse! In this course, I will learn how to work with frontend, backend, and the server side of a web application - The “Full Stack” - Via JavaScript.
BC5DD875-CFE8-4490-8972-A88222DDC753.jpeg
Here’s a little more about the course, If you’re curious.
Loading…

Want to print your doc?
This is not the way.
Try clicking the ⋯ next to your doc name or using a keyboard shortcut (
CtrlP
) instead.