Labs
Resources for this lab: resources/labs
Introduction¶
The following section details a list of code to implement in order to further your understanding of datatypes in JavaScript.
This lab is covered by tests, and these tests will fail until you write the code necessary to make them pass.
Lab¶
-
Create variables to hold the following information about a dog:
- nickname
- weight
- length of tail
- whether or not it is friendly
Assign these variables with values of the corresponding types.
NOTE: In JavaScript, variables are not statically typed, so their type is set dynamically based on values.
-
Use
console.log()to log the value of each of the variables to the console. -
Re-assign the following variables with boolean values.
let age = 9; let address = '1908 South Banana Street'; let date = '12/4/2018'; let url = 'http://localhost:8080'; -
Create an array literal in a variable named
months, and add each of the twelve months stored as strings. Useconsole.log()to log the month you were born. -
Declare a variable
name, but don't initialize it. Useconsole.log()to print out the variable. What is the result?