Home HTML Data Types DOM JavaScript JS Debugging Review Ticket

Hacks

  • Write a JavaScript program that compares two variables, a and b. Log “a is greater” if a is greater than b, “b is greater” if b is greater than a, and “both are equal” if a and b are equal. Make sure to use if statements and console.log
%%js

console.log("Conditional If/Then Statements as well as comparisoms");

// Number 1, a comparison between two of my favorite Crypto Coins

let Bitcoin = 8.0;
let Ethereum = 8.7;

if (Bitcoin > Ethereum) {
    console.log("Bitcoin is a better crypto coin");
} else if (Bitcoin === Ethereum) {
    console.log("Both coins are equally rated");
} else {
    console.log("Etheruem the better coin");
}

// Number 2, a comparison between two of my ideas for passion projects


let eCommerseWebsite = 8.1;
let cryptoTxChecker = 8.7;

if ( eCommerseWebsite > strangerThings) {
    console.log("ecommerse website is a better choice");
} else if (eCommerseWebsite === cryptoTxChecker) {
    console.log("Both choices are equally rated");
} else {
    console.log("cryptotxchecker is a better project");
}


<IPython.core.display.Javascript object>