Tuesday, July 17, 2018

Coding diary Day Three


The thing I felt happy is that finally, I learn something from galvanize, when I asked the instructors question I learn a lot and also save a lot of time

Today I learned:
(1) I still need to know how to explain  Scope in English.
(2) I still need to know how to explain Closure in English
(3) We can skip the " Generator"
(4) Watching CS50 React Native is not so efficient for me, maybe I can ignore some hard part, because of Harvard students are too smart.



The happiest thing is I know how to make a map functionality by manually
The problem from yesterday and I remember I need to put callback function inside if I want to rebuild it.

llet arr = [34,5,3]
 
arr.__proto__.mymap = function(callback){
  let newArr=[];
  for(let i=0;i<this.length;i++){
    newArr.push(callback(this[i]))
  }
  return newArr;
}
 
function myCb(item){
  return item*2
}
 
 
arr.mymap(myCb)

(1)Do I need to know  I can put 3 parameters in the callback function of map/ forEach etc?  Because usually I just use array [i], seldom use I, an array for the parameter.

Ans :  it depends on your implementation, you could leave it out, but it’s nice to leave in on the chance that your callback function actually needs to know what i is

(2)Why didn’t you put catch()  when you use fetch to request the HTTP in the class before? is it not necessary?

Ans :  catch() is not required, though it is recommended to be used because it will allow you to more gracefully catch & handle any potential errors that occur during the request

(3) Is Generator important? I watched some video, but it’s hard to understand

Ans: I haven’t seen many practical uses/applications of generator functions so far so I can’t speak to its importance at this moment, though I encourage you to read up more on it and see if you can find a practical application of it!

The question for tomorrow:
(1) opacity

(2) Wake up early tomorrow

Tomorrow plan

(1)Finish the checkpoint, especially the project part
(2) Finish the Modern JS ASAP


I talked about my dream with my cohorts, I hope after 5 years I can go to Japan or Italy to work, life is short, I hope I can explore the world more.

BTW, I forget to bring my lunch box today, so I took a lot of community food( Cheese) and put them in the microwave to be my dinner, at first it delicious, but after a while I almost want to vomit, because I ate too much, I think in a short time I don't want to eat Cheese anymore

No comments:

Post a Comment

Day 13

(2) so is that possible to build it from scratch? (3) is that mean it’s better to do that by service? how about if i want to find a API? ...