@Zurc That is technically correct, but you wouldn’t want to create functions as strings. A library created in this fashion would be difficult to scale and test.
@lyndseybrowning That would work, however it breaks the API of the exercise
Thanks @justinbmeyer & congrats for the baby but most importantly good luck after birth 😀
Justin Meyer
@justinbmeyer
ha, thanks, no problem
Emmanuel Hernandez
@ManuH
hey guys My friend @sebastianlujan and I were trying to make the task but couldn't do so. We decided to check some of the answers and neither of us could make the codes work
need some help
Sebastian
@sebastianlujan
we coded in cloud9 but I don't think that's the problem
Alexis Abril
@alexisabril
@ManuH@sebastianlujan Be sure to join us this Wednesday. We’ll always go over the prior week’s exercise & solutions the following week.
Lotfi Harrabi
@lotfire
@sebastianlujan@ManuH could you post your code here or give a link?
George Heeres
@gheeres
var make = function(){
var result = {};
[ 'a', 'h1' ].forEach(function(element){
result[element] = (function(name){
return(function(){
return(document.createElement(name));
});
})(element);
});
return(result);
}();
so when I use de "new" operator 'this' points to the function ?
Alexis Abril
@alexisabril
@ManuH “this” in that example would point to the newly created object
@lotfire A “constructor” is just a function we invoke with the “new” keyword
@lotfire we expect a constructor function to create a new object with its proto chain setup(eg: a new Person() should return an object that “inherits” from Person.prototype)