hands-on lab

JavaScript Primitive Data Type Variables and Console Log

Difficulty: Beginner
Duration: Up to 40 minutes
Students: 1,333
Rating: 3.9/5
Get guided in a real environmentPractice with a step-by-step scenario in a real, provisioned environment.
Learn and validateUse validations to check your solutions every step of the way.
See resultsTrack your knowledge and monitor your progress.

Description

In programming, variables are named containers for the purpose of storing data. This value may or may not change depending on the type of variable and the conditions set forth by the program's instructions (code).

console.log() is a function that prints a message to the JavaScript console. The message printed is dependent on what is pass through as an argument inside of the parentheses.

In this lab, you are to declare variables of different primitive types. Then output each variable's value in the console.

Learning Objectives

Upon completion of this lab, you will be able to:

  • Declare variables of different primitive data types
  • Use console.log() to output the variable's value to the console

Intended Audience

  • Beginners learning front-end development
  • Software Engineers who need to learn front-end technologies to expand their skill set

Prerequisites

The following courses and labs can ensure your success:

Covered topics

Lab steps

Introduction to JavaScript Labs
Declare a string variable
Display string in the console
Declare a boolean variable
Display boolean in the console
Declare a number variable
Display number in console