Skip to content

Commit b9b4f11

Browse files
committed
Update Udemy_The_Complete_JavaScript_Course_2021.js
1 parent c379149 commit b9b4f11

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

Udemy_The_Complete_JavaScript_Course_2021.js

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3654,7 +3654,7 @@ const game = {
36543654
// SLICE Method
36553655

36563656
// With the slice method, we can extract part of any array without changing the original array.
3657-
// So essentially, we can take a slice of an array. And so that's why it's called slice.
3657+
// Basically we take a slice of an array and that's why it's called slice.
36583658

36593659
console.log(arr.slice(2)); // (3) ["c", "d", "e"];
36603660
console.log(arr.slice(2, 4)); // (2) ["c", "d"];
@@ -3668,10 +3668,10 @@ const game = {
36683668
// starting from index 1, it extracts everything except the last two elements
36693669
console.log(arr.slice(1, -2)); // (2) ["b", "c"];
36703670

3671-
// we can also use the slice method to simply create a shallow copy of any array
3671+
// important: we can also use the slice method to simply create a shallow copy of any array
36723672
console.log(arr.slice()); // (5) ["a", "b", "c", "d", "e"];
36733673

3674-
// spread operator does the same. its up to you to chose which
3674+
// important: spread operator does the same. its up to you to chose which
36753675
console.log([...arr]); // (5) ["a", "b", "c", "d", "e"];
36763676

36773677

@@ -3698,14 +3698,16 @@ const game = {
36983698
// So it's actually not the begin parameter.
36993699
// It works a little bit different than in the slice method.
37003700

3701+
// arr = ["a", "b", "c", "d"];
37013702
arr.splice(1, 2);
37023703
console.log(arr); // (2) ["a", "d"];
37033704

37043705

37053706
// REVERSE Method
37063707

3707-
// The reverse() method reverses an array in place. The first array element becomes the last, and the last array element becomes the first.
3708-
// important: But now what's important to note here is the fact that the reverse method does actually mutate the original array.
3708+
// The reverse() method reverses an array in place.
3709+
// The first array element becomes the last, and the last array element becomes the first.
3710+
// important: What's important to note is the fact that the reverse method mutates the original array.
37093711

37103712
arr = ['a', 'b', 'c', 'd', 'e'];
37113713
const arr2 = ['j', 'i', 'h', 'g', 'f'];

0 commit comments

Comments
 (0)