-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlearningsThroughProblemSolving.txt
36 lines (30 loc) · 1.14 KB
/
learningsThroughProblemSolving.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
"a".charCodeAt(0); -- finding ascii code
String.fromCharCode(ascii_code) -- vice versa should work in this fashion
num = Math.floor(num / 10) --- for dividing by /10 an integer (like in java)
let items = new Map() --- map data structure in javaScript
map. set() .get() .has() .size .delete() .clear
for (let [number, activity] of activities) { --- for iteration purposes
console.log(`Activity ${number} is ${activity}`);
}
//so this is kinda string behaviour but it is what it is
type DayOfTheWeek = "sunday" | "monday" | "tuesday" | "wednesday" | "thursday" | "friday" | "saturday";
type DayOfTheWeekMap<T> = { [day in DayOfTheWeek]: T };
const chores: DayOfTheWeekMap<string> = {
"sunday": "do the dishes",
"monday": "walk the dog",
"tuesday": "water the plants",
"wednesday": "take out the trash",
"thursday": "clean your room",
"friday": "mow the lawn",
"saturday": "relax",
};
//Some another stuff I didn't know about
interface IRuleKey {
[index: number]: number;
}
const temp: IRuleKey = {
12: 0,
};
console.log(temp[12]);
//How to make 2d array work???
look at the question no 018.ts -- pretty dope shit heheh