For all the self-taught geeks out there, here is our content library with most of the learning materials we have produced throughout the years.
It makes sense to start learning by reading and watching videos about fundamentals and how things work.
Data Science and Machine Learning - 16 wks
Full-Stack Software Developer - 16w
Search from all Lessons
Curated list of small interactive and incremental exercises you can take to get better at any coding skill.
Curated section of projects to build while learning with simple instructions, videos, solutions, and more.
Guides on different topics related to the technologies that we teach in our courses
Social & live learning
The most efficient way to learn: Join a cohort with classmates just like you, live streams, impromptu coding sessions, live tutorials with real experts, and stay motivated.
Javier Leyva Seiglie
This is the simpliest way to create an object, the downside is that you´ll need to set the properties for each of the objects you want to create manually. The example is as follows:
To create an object with the built-in constructor use the following sintax:
Ok, we created an empty object, now let´s give it some properties:
Now, if we check the obj, we see the properties we just added
Using a user defined constructor function we take care of a problem that happens when using the
new Object() and is that, the later, is longer to code and not quite dynamic as the one we´ll discuss now.
Every time we´ll execute the
Geek() function, we´ll pass the value of the properties
Object.create() receives an obj as prototype (or blueplrint) and creates a new object from it
proto: the object used as prototype
propertiesObject(optional): If specified and not undefined, the properties you want to add to the new object
An example will be most welcome to make all that more understandable, here it is:
First we create our prototype obj (parent object, or anyway you feel more comfortable to name it).
We use the
Object.create() method, and as first argument we pass the
geekForce object, then we follow the syntax:
A full example would look like this:
Now that we have our prototype object, we can use it with
Object.create() like this:
Now, let´s see the properties we just added
If we want to create an object that needs other object properties as its own, then we use the Object.assign() method.
This method copies all enumerable own properties from one or more source objects to a target object. It returns the modified target object.
Let´s see an example, given two objects:
Now, we want to create a new object that cointains both of them.
Hope you enjoyed the reading and keep on the geek side.