My First Javascript Program

In this lab you will learn how to write your first javascript program

Challenge 1

  • Inside the main directory of this repository create a new directory called Scripts. See the lab guide on how to do this.

  • Inside the Scripts directory, create a JavaScript file called App.js

  • In the <head/></head> section of the index.html file, write code to correctly reference the App.js file you just created. (be sure to use defer)

Challenge 2

  • Write a program that prints an ascii art to the console. Follow this link to get some inspiration,

https://www.asciiart.eu/

IMPORTANT! This is tricky because many characters are reserved for coding and will create errors when you try to log them to the console. For example,

console.log("This is a backslash \");

Will create an error. To print a backslash to the console you need to proceed the backslash with another backslash. This tells the browser to ignore the backslash as code. The following for example would print without error,

console.log("This is a backslash \\");

You will notice many of the ascii arts contain backslashes and other illegal characters. If you wish to include these characters in your ascii art you MUST escape them.

Challenge 3

  • Write code to log the following statements to the console exactly as shown,

     Problem 1: 79 + 3 * (4 + 82 – 68) -7 + 19
     Problem 2: (179 + 21 + 10)/7 + 181
     Problem 3: 10389 * 56 * 11 + 2246
    
  • Write code to log the answer to each of the problems above. Do not do the calculations yourself, let the browser do the work!

Challenge 4

  • At the top of your App.js file use comments to indicate the following on separate lines

    • Your name
    • Period
    • Date
  • Use block quotes to write a comment that describes the ascii art you created.