Skip to content

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

  1. 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.

  2. Use console.log() to log the value of each of the variables to the console.

  3. 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';
    
  4. Create an array literal in a variable named months, and add each of the twelve months stored as strings. Use console.log() to log the month you were born.

  5. Declare a variable name, but don't initialize it. Use console.log() to print out the variable. What is the result?


Prev -- Up