Daily Report
  • Day 1 - 22/8
  • Day 2 - 23/8
  • Day 3 - 24/8
  • Day 4 - 25/8
  • Day 5 - 26/8
  • Day 6 - 28/8
  • Day 7 - 29/8
  • Day 8 - 30/8
  • Day 9 - 4/9
  • Day 10 - 5/9
  • Day 11 - 6/9
  • Day 12 - 7/9
  • Day 13 - 8/9
  • Day 14 - 9/9
  • Day 15 - 11/9
  • Day 16 - 12/9
  • Day 17 - 14/9
  • Day 18 - 15/9
  • Day 19 - 18/9
  • Day 20 - 19/9
  • Day 21 - 20/9
  • Day 22 - 21/9
  • Day 23 - 22/9
  • Day 24 - 23/9
  • Day 25 - 25/9
  • Day 26 - 26/9
  • Day 27 - 27/9
  • Day 28 - 28/9
  • Day 29 - 29/9
  • Day 30 - 2/10
  • Day 31 - 3/10
  • Day 33 - 7/10
  • Day 32 - 4/10
  • Day 34 - 9/10
  • Day 35 - 10/10
  • Day 36 - 11/10
  • Day 37 - 16/10
  • Day 38 - 17/10
  • Day 39 - 18/10
  • Day 40 - 19/10
  • Day 41 - 20/10
  • Day 42 - 21/10
  • Day 43 - 23/10
  • Day 44 - 25/10
  • Day 45 - 26/10
  • Day 46 - 27/10
  • Day 47 - 30/10
  • Day 48 - 31/10
  • Day 49 - 1/11
  • Day 50 - 2/11
  • Day 51 - 3/11
  • Day 52 - 5/11
  • Day 53 - 6/11
  • Day 54 - 7/11
  • Day 55 - 8/11
  • Day 56 - 9/11
  • Day 57 - 10/11
  • Day 58 - 13/11
  • Day 59 - 14/11
  • Day 60 - 15/11
  • Day 61 - 16/11
  • Day 4/12
  • Day 6/12
  • Day 7/12
  • Day 8/12
  • Day 12/12
  • Day 13/12
  • Day 14/12
  • Day 15/12
  • Day 16/12
  • Day 18/12
  • Day 19/12
  • Day 20/12
  • Day 21/12
  • Day 25/12
  • Day 26/12
  • Day 27/12
  • Day 28/12
  • Day 29/12
  • Day 3/1
  • Day 4/1
  • Day 5/1
  • Day 8/1
  • Day 10/1
  • Day 11/1
  • Day 12/1
  • Day 13/1
  • Day 15/1
  • Day 16/1
  • Day 17/1
  • Day 18/1
  • Day 19/1
  • Day 23/1
  • Day 24/1
  • Day 27/1
  • Day 29/1
  • Day 30/1
  • Day 1/2
  • Day 2/2
  • Day 5/2
  • Day 6/2
  • Day 15/2
  • Day 16/2
  • Day 17/2
  • Day 19/2
  • Day 20/1
  • Day 21/2
  • Day 22/2
  • Day 23/2
  • Day 26/2
  • Day 27/2
  • Day 28/2
  • Day 29/2
  • Day 1/3
  • Day 4/3
  • Day 5/3
  • Day 6/3
  • Day 7/3
  • Day 8/3
  • Day 9/3
  • Day 11/3
Powered by GitBook
On this page

Day 36 - 11/10

PreviousDay 35 - 10/10NextDay 37 - 16/10

Last updated 1 year ago

Plan:

Learning Js:

Converting webpage to html/css:

Progress:

Switch

switch(expression) { case x: // code block break; case y: // code block break; default: // code block }

  • break: break out of the switch

  • default: the code will be automatically run when no case match; can be anywhere in switch block

  • This will make case 4 and 5 share the same code:

case 4:

case 5:

text = "Soon it is Weekend";

break;

  • If multiple cases matches a case value, the first case is selected.

  • If no default label is found, the program continues to the statement(s) after the switch.

  • The values must be of the same type to match the cases.

Loops

for (expression 1; expression 2; expression 3) { // code block to be executed }

  • expression 1: can initiate many values in expression 1

for (let i = 0, len = cars.length, text = ""; i < len; i++) {

text += cars[i] + "<br>";

}

  • can omit expression 1 when the values are set before the loop

  • If omit expression 2, must provide a break inside the loop.

For-in Loop

Loops through the properties of an Object and Array:

const person = {fname:"John", lname:"Doe", age:25};

let text = "";

for (let x in person) {

text += person[x];

}

For each Loop

.forEach() : Call a function once for each array element

For of Loop

Loops through the values of an iterable object

for (let x of language) {

text += x;

}

While

  • do - while: always execute the code once before checking the condition

Break

  • break; : break out of the block

  • continue; : skip one iteration in the loop

Sets

Set is a collection of unique values, each value appear once

  • new Set()

const letters = new Set(["a","b","c"]);

  • .add() : add element to the tail; if equal elements are added, only the first one kept

  • delete(): remove an element

  • .has() : return true if an element exist

  • .forEach()

  • .values() : Return an iterator with all the values

  • size

Map

A Map holds key-value pairs where the keys can be any datatype.

Create map

  • new Map([ ]); : pass an array to map

  • map.set(key, value) : create a map and set new pair of value

const fruits = new Map();

fruits.set("apples", 500);

Method

  • .set(key, value); : can be used to add value, and change existing value

  • .get(key); : get the value of a key

  • .size; : return the number of element in a map

  • .delete(key); : remove a map element

  • .has(key); : check if a key exist

  • .entries(): returns an iterator object

Type of

  • Undefined and Null are equal in value but different in type

  • (A instanceof B); : check if object A is an instance of object B

  • :void()

Type conversion

String to Number

  • Number() : convert a variable (or a value) into a number

  • parseFloat() : Parses a string and returns a floating point number

  • parseInt() : Parses a string and returns an integer

  • '+' operator: the variable cant be converted will have type Number but value NaN

let y = "5";

let x = + y;

Number to String

  • String(x)

  • x.toString()

  • toExponential(): Returns a string, with a number rounded and written using exponential notation

  • toFixed() : Returns a string, with a number rounded and written with a specified number of decimals.

  • toPrecision() : Returns a string, with a number written with a specified length

Date to Number

  • Number(d)

  • d.getTime()

Date to String

  • String(x)

  • x.toString()

  • date methods

Boolean to Number

  • Number()

Boolean to String

  • String(b)

  • b.toString()

Automatic String Conversion

When output an object or variable, toString() will be automatically called

https://arena-zeexo-simple.myshopify.com/?fts=0#