Frontend Scrapbook

Notes that make a difference

Tail call optimization ( TCO ) & Trampoline

By admin on Sat Jun 13 2020

TCO allows recursive functions to re-use the stack frame instead of creating new frames on every call. New stack frames are created as we have more work to do ( adding to sum variable after sunRecursive return on every call ) The idea is to avoid adding to return value of call to sumRecursive once […]

Partial application vs Currying

By admin on Sat Jun 13 2020

Are two different techniques for specializing generalized functions The above example is a partial application over function ‘add’. It takes some parameters ‘now’ and rest ‘later’. Currying on the other hands says, it is going to assume every given input as ONE of its inputs to the function and return a function which can be […]

Referential transparency

By admin on Sat Jun 13 2020

Function purity is determined by its referential transparency. ie, ability to replace the function call with its return. This improves readability of the code. As in above example, it is guaranteed that the call to function x will always produce 11. Then we call such a function, a pure function in functional programming. Referential transparency […]

Assignment immutability vs Value immutability

By admin on Fri Jun 12 2020

const x = [1,2,3] x = 4 // TypeError : assignment to constant variable x[1] = 10 x become [1,10,3] as array is mutable value. Here ‘const’ keyword provides assignment immutability. When we talk of immutability in general, we mean value immutability. Also, const keyword is block scoped. So it doesn’t affect anything outside the […]

Some git rules for clean repository

By admin on Wed Jun 10 2020

Perform work in a local branch. Here’s why Update your feature branch with latest changes from develop by interactive rebase. More on this here If there are conflicts, resolve them first. and continue rebase Push your branch. As rebase will change history use -f to force changes into the remote branch At this point, you […]

Access Redux store external to react ecosystem

By admin on Tue Jun 09 2020

I recently happen to see a code written by an experienced developer. global is like ‘window’, but in NodeJS env. By default, all the variables, functions declared has local scope in a Node module. If you consider all the files are imported within a container namespace, global points to exactly the same, where you can […]


By admin on Fri May 15 2020

RESPONSE : Paint in less than 100 milliseconds. An action for example is to click on a button to trigger paint. ANIMATION: Each frame completes in less than 16 ms. Example is smooth scroll or drag. IDLE: Use idle time to proactively schedule job. Complete the job in 50ms chunks ( as user might interact […]

← Older posts