Skip to content

Instantly share code, notes, and snippets.

@KCWill
Last active January 10, 2020 02:18
Show Gist options
  • Save KCWill/e8d9cc2954d6c1404ac2e74541e63b45 to your computer and use it in GitHub Desktop.
Save KCWill/e8d9cc2954d6c1404ac2e74541e63b45 to your computer and use it in GitHub Desktop.

Beginner's Guide to Data Types

Types of Data:

  • String
  • Integer
  • Float
  • Array
  • Boolean

1. String

Strings are phrases or characters that are surrounded by quotation marks.

Example:

var greeting = "Hello, how are you today?";

2. Integer/Float

Integers are positive or negative whole numbers (includes zero). Floats are similar; they include all numbers with decimals. Example:

An integer: var population = 4;

A float: var average = 4.5;

3. Array

An array is a collection or series of data types. The data could be strings, integers, floats, or boolean values.

Example:

var animalFarm = ["Chicken", "Cow", "Pig", "Duck"];
var animalLegs = [ 2, 4, 4, 2];

4. Boolean

A boolean value is used to perform logic with statements that are either true or false.

Example:

var happy = true;
var sad = false;

Logic

@corneliusellen
Copy link

@KCWill amazing image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment