2020/11/11

Marianne's crying now...

 


Who to blame ?

"You made my planet a burning fire

You're getting to be my scariest mire

You're getting to be all struggling me … and let me tell you - ego

I hope and pray each day I live

A little less power each day you live

A little less strength on devotion to you

'Cause... all I do - is put the blame on you

All I do -  is put the blame on you

All I do -  is put the blame on you

Ego, just suppose I should happen to cross your mind

And by some chance a boy like me you're really been trying to find

Well let me tell you ego

Think of how exciting it would be

If you should disappear let us free 

If you should flee and let us go

We'll I'm gonna tell you - ego

I'd light a candle every day

And pray that we’ll always feel this way

And pray that our love will forever be new

'Cause... all I do - is put the blame on you

and do so on ..."


#CoronaVsEgo

> All i can do is listening the best forever Stevie WOooonder

2020/11/02

I can explain JS Async & Scope



Javascript is based on a single threaded queue mechanism where the engine determines :
  1. when a piece of code should be called (call stack)
  2. within some context (piece of heap)

Please look at the "challenge" and fix it : https://embed.plnkr.co/plunk/Id8dupPl7XVWRwCb



And dig into first important piece the context (heap) :


1 - Context concepts

Scope

Scope is the accessibility of variables, functions, and objects in some particular part of your code during runtime.

Global Scope vs Local Scope

Global scope lives as long as your application lives. Local Scope lives as long as your functions are called and executed.

Block Statements : "var" vs "let" "const"

Contrary to the var keyword, the let and const keywords support the declaration of local scope inside block statements.

Context vs Execution Context

Context is used to refer to the value of "this" in some particular part of your code. Each function creates its own execution context (related to Scope).

Lexical Scope vs Closure

A closure is the combination of a function bundled together (enclosed) with references to its surrounding state (the lexical environment); Lexical Scope means that in this nested group of functions, the inner functions have access to the variables and other resources of their parent scope.

ES5 Function vs ES6 Arrow function

Much more than a "syntactic sugar" but a real useful tool coming with ES6.

Conclusion

In brief, when it's possible: letconstarrow function

No more reason to bypass now:

Resources

Now look at the second piece, the asynchronous mechanism :

2 - Async

JavaScript has a concurrency model based on an event loop, which is responsible for executing the code, collecting and processing events, and executing queued sub-tasks.




Callbacks vs Promises... vs Async

But also generators, observables and other reactive way of writing asynchronous code...

In brief, when it's possible: async , await

No more reason to bypass now:

Resources

... Final challenge solution

One solution can be found here : https://plnkr.co/edit/JTDgFGu1LaIq7HEO?preview



Hope it helps you to write better Javascript code ?!

2020/04/05

How I wish those days could come back once more ?

"Looking back on when I
Was a little nappy headed boy
Then my only worry
Was for Christmas what would be my toy
Even though we sometimes
Would not get a thing
We were happy with the
Joy the day would bring

Sneaking out the back door
To hang out with those hoodlum friends of mine
Greeted at the back door
With "boy thought I told you not to go outside,"
Tryin' your best to bring the
Water to your eyes
Thinkin' it might stop her
From woopin' your behind

I wish those days could come back once more
Why did those days ev-er have to go
I wish those days could come back once more
Why did those days ev-er have to go
Cause ... " #CoronaDidSo

> I wish from the best forever Stevie WOooonder