Image for post
Image for post
Photo by SpaceX on Unsplash

As developers we all know the feeling or fear of being left behind at some point. Every day tens of new technologies (repositories) are trending in github, may be is the next React, x Script or Machine Learning framework and we like to know more about it.

So what can we do ?
Try to learn as much new things as we can or give up and stick with the good old tools we already know ?
I believe in being pragmatic, learn what really matters and wait for the right moment.

Don’t follow the hype

Yes, never follow the hype, you don’t need to learn about every new thing that came out, don’t care if your friend tried it neither, wait some months until the water is clear and more people are using it in production, then be smart, read about it, learn what are the pros and cons, gather your own opinion and make an informed choice about it. …

If you are learning Javascript or functional programming write your own implementation of a curry function could be an interesting way to better understand this technique.

currying is the technique of translating the evaluation of a function that takes multiple arguments(or a tuple of arguments) into evaluating a sequence of functions, each with a single argument. — wikipedia

Image for post

Let’s think about what we need:
1- A function that will receive another function to curry.
2-
return another function that will ask for 1 or more arguments for the original function, this function should somehow save all the arguments it received while the original function still not meet the amount necessary to be called. …

Image for post
Image for post
Photo by funnyjunk.com

Today we are going to talk about these 3 global Objects (functions) in JavaScript and how to use them as factory functions to coerce different values.

Important:

You can use Boolean, Number and String as:

Constructor functions (Bad)

If we use them with the new keyword then we will always return an object - not what we expected:

This is a very confusing thing to do in your programs. All 3 are regular objects with prototypes and methods. Don’t use new. …

About

J.C. Martin

Full-Stack Developer: @juliomatcom, Github, Javascript, https://juliocesar.space/

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