Aprende todo un fin de semana sin pagar una suscripción 🔥


Comienza en:






-4. Advanced Fundamentals


A proxy is an object that allows us to read the differences in the string between the prompt we introduce and the property the handler, like GET and SET, is reading from the target object.

Basically, this object receives two parameters, the target object, and the handler. The handler contains the pseudo-element with the properties of the object targeted and the property introduced by the client. Through these functions, it does compare both, and thanks to a framework like Levenshtein (That size how two string differs in characters number) we can make suggestions to the client in case the prompt introduction was wrong.

Levenshtein framework --> https://github.com/hiddentao/fast-levenshtein

Conclusion: Proxy object receive and object and the handler: get, set, etc. In the handler, it receives the object targeted and the prompt introduced by the user. The trough function compares all the keys of the object with the prompt, and if there is a difference it makes suggestions to the user.


These are function that remembers the code inside, the way to declare them is function*() {}.
This when called instead of returning a value, returns an object with two parameters: value, value return, and done, if the function is done. But to return this object it must be called with the method “.next()”.

Inside the function, we situate breakers “yield” that can return values and if we add more than one, every time we called the function with next it will jump from yield to yield.
These generators are commonly used in whiles or infamous cases like Fibonacci operations.

Conclusion: Generators are useful if we want to remember the operations, but it is really limited to its usage. This is a special function we can call and stop and again call it when it is needed without breaking or damaging the result because is already saved in the scope of the generator.

Escribe tu comentario
+ 2