WDV221 Intro Javascript

Unit-2 - Variables Assignment

Please complete the following exercises on this page. When complete post this page to your server. Make a link in your WDV221 homework page for this assignment.

Submt this assignment on Canvas. Please include a link to your homework page.

For each exercise use a comment line to put the Exercise number within the script. Also place a short description of what the script is doing.

  1. Define a variable call schoolName. Display the variable in the console. *Review the value of a variable that has been defined but has not been assigned a value.

  2. Assign "DMACC" to schoolName. Display the variable in the console. *The quotes make this a String data type.

  3. Assignment 42 to schoolName. Display the variable in the console. *This changes the datatype of the variable from a String to a number. Notice that a JavaScript variable changes datatype based upon it contents.

  4. Define a variable called courseName and assign it a value of WDV221 Intro Javascript. Use document.write() to display the value of the variable within the following paragraph instead of courseName shown below.

    Hello! Welcome to .

  5. Define a variable called testScore and assign it a value of 100.00. Use console.log() to display the value of the variable. *Notice how JavaScript treats the .00.

  6. Define a variable called courseGrade. Assign it a value of 88.65. Use console.log( ) to display the value of the variable. *Notice how JavaScript treats this number.

  7. Define a variable called courseCompleted. Give it a value of false. Use console.log( ) to display the value of the variable. *Notice this is NOT a String datatype. true and false are reserved word within Javascript.

  8. Assign a value of "false" to courseCompleted. Make sure and use the "" to make this a String datatype. Use console.log( ) to display the value of the variable. *Notice the difference between 7 and 8.

  9. Create a variable called stringType. Assign it a value that makes the variable String data type. Use console.log( ) to display the variable stringType

  10. Create a variable called numberType. Assign it a value that makes the variable a number data type. Use console.log( ) to display the variable numberType.

     

Return to WDV 221 Homework Page