callback() on each element, and returns a new array with the new results.
map() accepts as parameters
- current element — The current element being processed in the array.
- the current element index — The index of the current element being processed in the array.*Optional
- the original array — The array
map was called upon.*Optional
- thisArgs — Value to use as
this when executing
map() returns a new array where each of the elements is the result…
One of the problems I had to solve recently involved handling Timezone and Date/Time data types. Whoever ever worked with both Timezones and Date/Time data types knows it is much much (much) harder than it looks!
For clarity, Let’s understand what is the difference between Timestamp and an Offset.
America/Los_angelesis a timezone.
One of the services I worked on didn’t handle timestamp data types as expected.
Array is one of the most commonly used data structure in the computer science world. If you ever had used a list of items such as todo list or playlist or a contacts list on your phone you most probably used an Array.
An array is a data structure for storing more than one data item that has a similar data type. The items of an array are allocated at adjacent memory locations where each identified by at least one array index or key.
Let’s imagine this grid is our computer memory. Each piece of information is stored in one…
Debounce function limits the rate at which a function can fire.
We want to use
debounce every time we trigger an event/make an API call/run a process that is a heavy task.
For example, an autocomplete. When a user types on an input element we want to send a server request to fetch the data that is relevant to the value the user typed. Imagine we will fire an API call every time a user is typing. Perform an API call is a heavy task so we really don’t want to perform it every time a key was pressed.
Flatten a dimensional array is a perfect problem to use recursion.
Recursion is great if you want to solve a big problem by solving smaller instances of that big problem.
Array we want to flatten
var arr = [1, [2, 3], []];
The output should be
var arr = [1, 2, 3, 4]
There are two main requirements of a recursive function:
A Stop Condition — the function returns a value when a certain condition is satisfied, without a further recursive call. …
To achieve it we use callback functions. a callback function gives us the ability to execute a function/event/action in an asynchronous way.
A callback function is a function passed into another function as an argument, which is then invoked inside the outer function to complete some kind of routine or action
Callbacks make sure that a function is not going to run before a task is completed but will run right after the task has completed. …
this keyword behaves a bit differently than other languages like C++, Java, etc.
While on those languages the
this keyword in the global and local scope and its value equals to the current object in that scope.
Through out my career as a Software Engineer I have always had the need to deal with API endpoints either from the front or the back side of the product.
From the client side I hit an existing endpoint and send the relevant data if needed, while on the server side I was needed to not only create the endpoint but also to add the logic of what happens when someone hits this endpoint.
I have never really noticed how exhausting it is to look for the specific file (on the server side) that handles the current endpoint until I…
To have a website, you need three things: domain name, web hosting, and a developed website.
Web hosting allow users to create and store content, like a website, on Internet servers.
Domain is a string of characters that give your website an identity. Each website has a domain name that serves as an address, which is used to access the website. Examples of domain name: google.com, medium.com, etc..
Every website most have a Domain and Web hosting.