reading-notes

Class 7: Programming w/JavaScript

Resources

Some Notes

Control Flow

JavaScript Functions

JavaScript Function Syntax

Function Return

function myFunction(a, b) { return a * b; // Function returns the product of a and b }

Local Variables

function myFunction() { let carName = “Volvo”; // code here CAN use carName }

// code here can NOT use carName

JavaScript Operators

Types of JS Operators

Replit Practice

// declaring a variable called theName // assigning it the value of the result of prompting // “What is your name?”

let favColor = “yellow” let userGuess = prompt(“What is my fav color?”); userGuess = userGuess.toLowerCase(); console.log(“Now user guess is: “ + userGuess); // console.log(“User guess is: “ + userGuess); if (userGuess == favColor){ console.log(“You are right.”); } else { console.log(“You are wrong.”); } // let userName = prompt(“What is your name?”);

if (userName == “ryan”) { console.log(“Hola compa, hear any good chisme on the cartel lately?”); } else { console.log(“Buenos Dias, Bolivia”) } console.log(“Welcome to Bolivia “ + userName); //

Things I Would Like to Know More About

Maybe in time, I will be able to memorize most of these operators, but as of right now there are soooooo many. I will have to reference the MDN often until I get the hang of these things.