how to save a lot of time and make fewer mistakes

Image for post
Image for post

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.

  1. Take the code and break down big pieces of code into small functions.
  2. If by the time you leave work you haven’t solved the problem. Turn off the computer and leave it for the next day. …


Ten useful methods that you can use in 2021

Image for post
Image for post

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!

1. Array.prototype.reduceRight()

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.

Syntax

arr.reduceRight(callback(accumulator, currentValue[, index[, array]])[, initialValue])

Examples

Sum array values:

const sum = [0, 1, 2, 3, 4].reduceRight(function(a, b) {
return a + b…


Fundamental concepts and tips to go up a level

Image for post
Image for post

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.

Fundamental concepts in a nutshell

  1. Create an object constructor.
  2. Create an IIFE (Immediately Invoked Function Expression).
  3. Prototype.
  4. Scope.
  5. Closures.

Handy tips

  1. Get a random number between x and y.
  2. Convert the arguments object to an array.
  3. Get the max or the min in an array of numbers.
  4. Avoid the use of eval().
  5. Avoid using the Function constructor. …


Wisdom, sometimes, needs no more than a few words

Image for post
Image for post

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!

1. Truth can only be found in one place: the code.

By Robert C. Martin.

I agree. The code, unlike the comments in it, never misleads. Besides, the code always does what it says. …


How to build your first Program in WebAssembly

Image for post
Image for post
Photo by Pixabay

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.

Why Wasm?

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. …


11 trick questions (and answers) you should be ready for in any coding interview

Image for post
Image for post
Photo of Pixabay in Pexels

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.

The importance of the scope of the variables

What’s the output?

Case 1

for (var i = 0; i < 5; i++) {
setTimeout(() => console.log(i), 1);
}

A: 0 1 2 3 4
B: 5 5 5 5 5

Case 2

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

Solution

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. …


How to do coding faster and better in 2020

A paper where it is written “time” burning
A paper where it is written “time” burning
Photo by Eugene Shelestov en Pexels

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

Index

  1. Transform && Filter an Array at the same time.
  2. Fetch && Retry.
  3. Recursive setTimeout.
  4. Get Fields and Length from an Array by Destructuring.
  5. Reverse a String.
  6. Clear an Array.
  7. Trimming an Array.
  8. Extending an Array.
  9. Create an Array from an Object.

1. Transform && filter an Array at the same time

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? …


Bad Coding Practices in JavaScript (and Solutions)

Image for post
Image for post

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!

Conditionals

Using If

//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();
  1. Here we are unnecessarily comparing the condition with the true value and writing a lot of code inside the block code.
  2. The first improvement to this code is to remove the comparison with true and leave its equivalent. …


Valid for any css framework

Image for post
Image for post
Illustration from https://undraw.co/

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. …


The developer that everyone wants to hire. Are you one of them?

A man with a beret writing on a blackboard
A man with a beret writing on a blackboard
Photo ofStartup Stock Photos in Pexels

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!

They are reliable

  • If something goes wrong, they will try to help whether it is their fault or not.
  • If something serious happens and they are needed, if they can help, they will do so, no matter what time it is.
  • They have a strong commitment to meet deadlines.
  • They make sure deadlines, requirements, and goals are realistic and understood by the whole team.
  • They can estimate quite accurately how long it will take to develop something, although we all know that this is often very difficult. …

About

Kesk -*-

Software engineer - software Enthusiast - Sci-Fi writer.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store