how to save a lot of time and make fewer mistakes
In this summary, I list some of the things that have helped me in my career. It reads fast, but applying them well can take a lifetime. I have been developing applications for almost 15 years, and still, sometimes, I have to stop and think in the essential parts of this profession.
As you probably already know, a JavaScript array is an object that represents a collection of elements. This article explains how to use the new methods that have been incorporated into JavaScript for handling arrays.
I hope you find it useful.
Let’s start!
The reduceRight() method executes the callback function once for each element present in the array, receiving four arguments: the initial value (or value from the previous callback call), the current element's value, the current index, and the array over which iteration is occurring.
arr.reduceRight(callback(accumulator, currentValue[, index[, array]])[, initialValue])
Sum array values:
const sum = [0, 1, 2, 3, 4].reduceRight(function(a, b) {
return a + b…
JavaScript has its detractors and followers but what is clear is that it is one of the most used languages nowadays and, I would say, funny because of the great number of tricks you can apply to it. In this article, I gather some fundamentals that you should know and a few tricks and tips.
Many times, you can learn more from a short phrase than from a whole book. In this article, I compile 38 quotes that contain many years of experience in their words and from which we can learn a lot.
If you have been in this world for years, surely when you read them, they will make you smile knowing that they are true.
Enjoy them!
By Robert C. Martin.
I agree. The code, unlike the comments in it, never misleads. Besides, the code always does what it says. …
In this article, I will show you how to compile a TypeScript program to WebAssemby that prints the factorial of a number.
I will write it using TypeScript and then compile it with AssemblyScript, which compiles a strict variant of TypeScript to WebAssembly(Wasm) using Binaryen.
WebAssembly is current an MVP and only handles integers and floats and doesn’t natively support strings or other types. For this reason, instead of the typical HelloWorld that uses Strings, I will write a function that takes in a parameter of the numerical type and that returns its corresponding factorial.
One of the most common reasons for use WebAssembly is its speed. Speed in a specific context is essential and can justify the sacrifice of other factors like developer experience, reliability, or maintainability. …
In this article, you have 11 trick questions done in Javascript. The questions seem easy but think hard enough about the answer because it is straightforward to fail.
What’s the output?
for (var i = 0; i < 5; i++) {
setTimeout(() => console.log(i), 1);
}
A: 0 1 2 3 4
B: 5 5 5 5 5
for (let i = 0; i < 5; i++) {
setTimeout(() => console.log(i), 1);
}
A: 0 1 2 3 4
B: 5 5 5 5 5
C: 0 1 2 3 4
Case 1: B.
Case 2: C.
In case 1, the setTimeout callback function is called after the loop has been executed(A second is a long time for a computer). The ‘i’ variable is declared using the ‘var’ keyword, and therefore it is global. When we invoke the setTimeout function after approximately one second, the ‘i’ has the value of 5. …
This article shows you how to resolve everyday JavaScript tasks by writing less code and using the language's latest features more straightforwardly.
There are ten small hacks that you can use in any part of your code without any difficulty.
Let’s start
We can transform and filter an Array using the map() and the filter() method in two steps, but why we don't transform it and filter in one step? …
In this small article, I list some of the things I usually see in code reviews. These are not things that will make our program fail, but they make it harder to read, harder to maintain, and more error-prone.
Let’s start!
//1.
if( condirion === true){
//A lot of code.
}//2.
if(condition){
//A lot of code.
}//3.
const doSomething = () => (
//A lot of code.
)if(condition){
doSomething();
}//4.
if (condition) doSomething();
This little post will show you how to build a simple autocomplete component that works with an array of elements-values [{},{},..]. You can easily integrate it with any css framework like bootstrap 4, and you can modify it to suit your needs.
We are going to use LitElement to build the Web Component. LitElement is a simple implementation that follows the Web Components standards specification.
First of all, what is an autocomplete element? Autocomplete or word completion is a software function that completes words or strings without typing them in full. …
Here I leave a small compilation of what I consider and share with other professional colleagues about what a great Software Engineer is. Enjoy it!
About