Skip to content

Instantly share code, notes, and snippets.

@michellekaplan7
Last active January 8, 2020 00:15
Show Gist options
  • Save michellekaplan7/c599432cd894618cd7ee59ae5b79803d to your computer and use it in GitHub Desktop.
Save michellekaplan7/c599432cd894618cd7ee59ae5b79803d to your computer and use it in GitHub Desktop.
Beginners Guide To Data Types - Mod 0 Session 1 Homework

Beginners Guide To Data Types

Data Types

1. String: a data type used to represent text that is wrapped in quotes. Strings can contain alphabet characters in addition to spaces, numbers, and special characters.

  • Ex: "this is a string"

2. Integer: a whole number (positive, negative, or zero)

  • Ex: 2, 9, -15, 9282

In JavaScript you can assign an integer value as a number (you can open the JavaScript console in Chrome by clicking Command + Option + J) :

var number = 5;

3. Float: a number with decimal points (positive or negative)

  • Ex: -3.4, 0.02, 91.23

4. Boolean: true or false/ can be used to check combinations (if a password is over 8 characters and has both a letter and number)

  • Ex: true or false

alt text

5. Array: a data structure that represents a group of things/used to organize data so that a related set of values can be easily sorted or searched. You can have an array of strings, integer/floats, or booleans.

  • Ex: [12, 2, 4, 9, 10, 12, 4, 3] or ["Tim, "John", "Henry", "Bob"] or [false, true, true, false, false, true, false]

6. Object: (for JavaScript) a collection of key-value pairs. Similar to an array in that it's a collection of things, but in the case of an object, we are pairing data together. Sometimes referred to as a dictionary. Ask yourself, "Is this a collection of data where the pairing of items matters?" (keys are first names, values are last names).

  • Ex: {"Mod 0": "Tim and David", "Mod 1": "Mike and Sal"}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment