JavaScript Iterators

Introduction When we talk about iterators there are two main protocols to be aware of: iterables and iterators. Iterables are data structures that can be iterated. Such example is array, since we can loop through every element of array. Iterator is a simple interface for looping through data – looping through iterable. Iterator is an object […]

Continue reading

JavaScript Symbols

JavaScript Symbols – Introduction Symbol is a primitive data type in JavaScript. Symbols represent a way to define object keys that will  never get in conflict with other keys. Since they are one of the primitive data types they are immutable. Their main purpose is to serve as an identifier for object’s properties.   Symbols […]

Continue reading

Decorators with TypeScript

This entry is part 4 of 4 in the TypeScript series

Introduction JavaScript decorators are a special kind of declaration. Decorators can be attached to both class declaration and class method declaration. Furthermore, they can be attached to accessor and property declaration. Finally, they can also be attached to parameter declaration. If you come from backend world and you have worked with C# or Java you […]

Continue reading

Tuples in TypeScript

This entry is part 3 of 4 in the TypeScript series

Tuples in TypeScript With tuples we can define what type of data (variable type) can be stored in every position ( or few starting positions ) inside of an array. Once you define the tuple you can then use it to declare variables. Tuple types in TypeScript express an array where the type of certain […]

Continue reading

Intersection types in TypeScript

This entry is part 2 of 4 in the TypeScript series

Intersection types Purpose of this post is to get a basic understanding of intersection types and realize pros and cons of intersection types. Last time we talked about union types: let x: string | number; Variable x can be either string or a number. Consequently, you can use type guarding technique to exclude one of […]

Continue reading