Skip to content

designbright/JavaScriptDataTypes

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 

Repository files navigation

Introduction to JavaScript Primitive Data Types

Data types are used to optimize the data that a variable can contain. Understanding primitive data types is a basic building block of when learning JavaScript

There are two categories of data types

  1. Primitives
  2. Objects

There are five primitive types:

  1. string
  • Example: "hello there!", 'hello there'
  1. number
  • Example: 1, 200, 3.14159
  1. boolean
  • Example: true, false
  • Booleans are used in control structures like conditional statements
  1. undefined
  • Example: undefined is the default value for any variable that has been declared but has not been assigned a value
  1. null
  • null is a representation of the intentional absence of any object value. Often used to indicate that a variable should hold a value and doesn't

Getting Started

  1. Create a new project directory with an index.html and main.js file
  2. Link your main.js file with your index.html file by adding <script src="main.js"></script> just before the /body tag in the index.html file
  3. Create and assign a variable for all JavaScript data types in the main.js file
  4. You should console.log the typeof each variable like the example below

let x = 'Sally Smith'; console.log(typeof x);

  1. Mutate each variable and console.log typeof each
  2. Perform mathematical operations using mixed data types and console.log typeof each

About

Introduction to JavaScript Data Types

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published