随笔分类 - Javascript
只有注册用户登录后才能阅读该文。
摘要:To see how to call another generator inside a generator: Example:
阅读全文
只有注册用户登录后才能阅读该文。
摘要:There are two ways to correctly type checks number: When using Number.prototype methods, some of them return String as result: We can see this string:
阅读全文
摘要:const result = Number('55px'); // isNaN "NaN" console.log(isNaN(result)); // true console.log(isNaN('I am a String!')); // true -- NOT Good console.log(Number.NaN); // safer approach console.log(Nu...
阅读全文
摘要:What's your expect of the output?: The answer is 'false'. Because: Therefore if we do calculation on Frontend: The result is not correct. The solution
阅读全文
只有注册用户登录后才能阅读该文。
摘要:A Proxy allows you to trap what happens when you try to get a property value off of an object and do some behavior before the value is accessed. For e
阅读全文
摘要:Private variable in class: class field syntax: Previously you need to call 'super' But now, we don't need to, you can use classs field: Above two feat
阅读全文
摘要:const log = console.log; // zero :: &fa.a const zero = f => x => x; // zero is F // once :: &fa.fa const once = f => x => f(x); // once it I // twice :: &fa.f(fa) const twice = f => x => f(f(x)); //...
阅读全文
只有注册用户登录后才能阅读该文。
摘要:All the tagged function really does is give us a function to fill the given named properties on an object. taggedSum is a combination of multi Typed c
阅读全文
只有注册用户登录后才能阅读该文。
摘要:Sometime you need to check one prop exists on the object and value should not be ´null´ or ´undefined´. One problem people may occur with: Here we mis
阅读全文
摘要:Imaging we have a deck of cards, eveytimes we need to pick one card from deck, the result we want to have is: For selected, each time we want only one
阅读全文
摘要:Using Naive JS: The main problem is inside 'rando' function, not really a FP way doing stuff. Arrow approach: It becomes complex with we need to do Pa
阅读全文
摘要:Recently, I am learning Working with ADT. Got some extra thought about State Monad. Basiclly how to thinking in State. First, we need to know the type
阅读全文
摘要:In previous post, Arrow Functor with contramap, we have seen how to opreating on params before we invoke the function by using Arrow + contramap. It h
阅读全文
摘要:This lesson teaches you how arguments passed to a curried function allow us to store data in closure to be reused in our programs and applications. Si
阅读全文
摘要:To demonstrate the difference between mutability and immutability, imagine taking a drink from a glass of water. If our glass is mutable, when we take
阅读全文