Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added CheatSheets/.DS_Store
Binary file not shown.
17 changes: 15 additions & 2 deletions CheatSheets/javascript-cheatsheet.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
- [Table of Contents](#table-of-contents)
- [1. Declaring Variables](#1-declaring-variables)
- [2. Lists](#2-lists)
- [2.1. New Array](#21-new-array)
- [2.1. New List](#21-new-list)
- [2.2. List Methods](#22-list-methods)

## 1. Declaring Variables

Expand All @@ -15,8 +16,20 @@

## 2. Lists

### 2.1. New Array
### 2.1. New List

```
const newArray = [];
```

### 2.2. List Methods

`let newArray = []`
| Method | Code | Notes |
| ------ | ----------------- | ------------------------- |
|pop()| `newArray.pop()` | Removes last element in the list |
|push()| `newArray.push(1)`| Adds element to end of list |
|shift()| `newArray.shift()` | Removes first element in the list |
|slice()| `newArray.slice(start-position, end-position)`| Copies elements in list from start position to end position. Doesnt affect original list.|
|splice()| `newArray.splice(start-position, end-position, new element(s))`| Removes or Adds element in list. Either adds element in between start-end or removes elements from start-end.|
|unshift() | `newArray.unshift(2)` | Adds element to beginning of list |