JavaScript

Typescript – cheat sheet

This cheat sheet contains typescript definitions that I sometimes use during development and that often can be easily forgotten. All examples are published on my codepen.io account so that you can directly edit and test them. They are also available in my codepen collection typescript cheat sheet. This cheat sheet is a work in progress and I will continue to add new sections. Wrapper function A wrapper function is a function that has the same signature as the target function it wraps. Wrapper functions are used applying aspect-oriented programming or a kind of implementation of the decorator pattern. See the Pen typescript cheat sheet – wrapper function by René Link… Read More »Typescript – cheat sheet

Lexical vs. dynamic scoping

In this blog I want to give you some examples about the difference between lexical and dynamic scoping. I will not dive into the details. You will find a lot of other resources about it. Here is a small list: Scope (computer science) Javascript — Lexical and Dynamic Scoping? What is lexical scope? The following JavaScript and Bash examples are almost equivalent in structure. Nevertheless they will lead to different results, because of the different scoping type these languages use. Lexical scoping – e.g. JavaScript In languages with lexical scope (also called static scope), name resolution depends on the location in the source code and the lexical context (also called static context), which is defined by… Read More »Lexical vs. dynamic scoping