In this Javascript tutorial from Codecademy, I learned the basics of Javascript and introduction of the langauage. The tutorial went through the syntax of the programming language, variables, and functions. I also learned how arrays worked in Javascript, loops, if statements and control flow of the programming language.
In this Codecademy Javascript tutorial, I created an if statement with else if. It prints a certain string based on the condition, in this case, which type of moon phase is given. I printed the string with console.log and used/ created the variable "moonPhase". Since the condition did not equal to the ones given, the else statement prints invalid moon phase. The image below is a screenshot of the tutorial.
In this Codecademy Javascript tutorial, I created a program that takes a pizza order. The parameters used in this function are "pizza topping" and "type of crust". A few other functions were also created to calculate the tax and total cost of the pizza. I learned how return statemnts worked in this example. 3 pizzas were ordered and the total was 23.85 after tax. The image below is a screenshot of the code.
In this Codecademy Javascript tutorial, I created a while loop that guessed the suit of a card. I created an array that contained 4 suits: Diamond, Spade, Heart, and Club. The randomized suit selected was a Heart but the suit guessed was a Spade. I created other variables such as "randomNumber" to produce the random suit from the array. The image below is a screenshot of the code.
Here is the link to Codecademy.