Skip to content

Commit e7eaf66

Browse files
its been a while
1 parent 95a599a commit e7eaf66

File tree

6 files changed

+33
-12
lines changed

6 files changed

+33
-12
lines changed

arrays-and-objects/destructuring-naming.js

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,9 @@ const {
2323
},
2424
} = userDetails;
2525

26-
console.log(fn);
26+
// console.log(userDetails);
2727

28-
// im not really sure if we can destructure array the same way we do wth objects, lets see below the way its been don
28+
// im not really sure if we can destructure array the same way we do wth objects, lets see below the way its been done
2929

3030
// DESTRUCTURE ARRAY
3131
const skills = [
@@ -46,10 +46,29 @@ const number = [1, 2, 3, 4, 5];
4646

4747
const [yo, ...rest] = number; // yo represent th first index in the array and it will return the value that maths it's position
4848

49-
console.log(yo, rest.join(" "));
49+
// console.log(yo, rest.join(" "));
5050

5151
const legs = ["wo", 1, 7, 7];
5252

5353
x = [...legs, "mandem"];
5454

55-
console.log(x);
55+
// console.log(x);
56+
57+
// NOTE the code was written two months after - MAY 17th Friday 2024, man i almost forgot stuffs bro
58+
const data = {
59+
name: "victor",
60+
age: 20,
61+
address: {
62+
state: "lagos",
63+
city: "lekki",
64+
street: "13B, cosmos estate",
65+
},
66+
occupation: "student",
67+
skills: ["tech", "design", "art", "skating"],
68+
hobbies: ["singing", "coding", "writing", "swimming", "chess"],
69+
relationships: "single",
70+
};
71+
72+
const { address, name: n } = data;
73+
74+
console.log(n);

basics/Strings.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Working with string
1+
// Working with string data types
22

33
let string = "Hello World"; // bts - string is a primitive data type and we are able to use methods and property on it which is common ony to reference data type
44

basics/Type-Coercion.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Type coercion happens when JavaScript implicitly change thr type of a variable to suit the situation
1+
// Type coercion happens when JavaScript implicitly change thr type of a variable to suit the situation.
22
let v;
33

44
v = 7 + "7"; // 77 - JS coverts the 7 to string and concatenate it to "77" - js reads + here as a concatenates and not an arithmetic operator

basics/date-time.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,4 +32,4 @@ d = d.toLocaleString("default", {
3232
timeZone: "Africa/Lagos",
3333
});
3434

35-
// JS intl date time format api
35+
// JS intl date time format API

basics/variables.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// RESERVED KEYWORDS - inbuilt Javascript that cannot be used for naming variables and stuffs, eg function, var, let , const, if, do, while and more.
22

3-
// you cn use the data types keyword to declare variables but its not a good practice
3+
// you can use the data types keyword to declare variables but its not a good practice
44

55
// LET - for declaring variables that can be reassign but not redeclare, it was introduced in version ES6 with "const Keyword", let is a block scoped variable and it is a reserved keyword
66

@@ -10,7 +10,7 @@ let name = "Victor";
1010

1111
let age; //undefined
1212

13-
// i can come down to assign it but its more comment in a if/else block
13+
// i can come down to assign it but its more common in a if/else block
1414

1515
// BLOCK SCOPE VARIABLES CANNOT BE REDECLAREd
1616

@@ -66,3 +66,5 @@ its possible to declare many variables at once and all
6666
let a = 1,
6767
b = 5,
6868
c = 7;
69+
70+
console.log(a, b, c);

functions/arrow-function.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// ONE OF THE SWEET FEATURES THAT CAME WITH ES6
22

3-
// first off, the js fucntion is declared this way
3+
// first off, the js funtion is declared this way
44

55
function NetworkSpeed(rate) {
66
return `your internet connection speed it ${rate}kb/s`;
@@ -31,7 +31,7 @@ const squareNumber = (x) => x * x; // const squareNumber = x => x * x; when i sa
3131
console.log(squareNumber(7));
3232

3333
// another shorter way
34-
// IM NOT SURE THER IS ANY SHORTER WAY
34+
// IM NOT SURE THERE IS ANY SHORTER WAY
3535

3636
// forEach loop
3737

@@ -43,5 +43,5 @@ numbers.forEach(function (num) {
4343

4444
// this can be rewritten in a more cleaner and shorter way
4545
numbers.forEach((n) => {
46-
console.log(n);
46+
console.log(`number ${n}`);
4747
});

0 commit comments

Comments
 (0)