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
8 changes: 8 additions & 0 deletions arrays/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,12 @@ Here is a simple array:
```javascript
// 1, 1, 2, 3, 5, and 8 are the elements in this array
var numbers = [1, 1, 2, 3, 5, 8];

numbers.length //returns 6

//add new element to the numbers
numbers.push(9) //returns [1, 1, 2, 3, 5, 8, 9]

//remove last element
numbers.pop() // returns [1, 1, 2, 3, 5, 8]
```
13 changes: 13 additions & 0 deletions loops/forEach.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# FOREACH
```js
var array1 = ['a', 'b', 'c'];

array1.forEach(function(element) {
console.log(element);
//return or break won't work here
});

// expected output: "a"
// expected output: "b"
// expected output: "c"
```
15 changes: 15 additions & 0 deletions objects/immutable.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Immutable
Immutable object values cannot be changed once it's declared.
```js
const obj = {
prop: 42
};

Object.freeze(obj); // this will freeze the values

obj.prop = 33;
// Throws an error in strict mode

console.log(obj.prop);
// expected output: 42
```