// Write a function called 'makeToDos'. This function should take two arguments: 'owner' and 'toDos'.
// 'owner' is a string of the name of the owner of the to do list.
// 'toDos' is an array of strings representing items to be done.
// 'makeToDos' should return an object with 'owner' and 'toDos' properties that correspond to the values passed in as arguments.
// It should also have a method called .generateHtml. This method should return a string representing an unordered list.
// Each item from toDos should appear as an
in the list.
// For example: if 'makeToDos' was called like this:
// makeToDos('Teddy', ['wake', 'eat', 'drink', 'work', 'sleep']),
// calling .generateHtml on the resulting object should generate a string like this:
// ''.
// Couldn't figure out how to do it
// Curriculum solution:
// owner - string meaning the name of the owner
// toDos - ARRAY of STRINGS representing ITEMS to be done
// makeToDos - should RETURN an OBJECT with 'owner' and 'toDos' properties that
// correspond to values passed as arguments
// Should have a method called '.generateHtml' which should return a string
// representing an UNORDERED LIST, each ITEM from 'toDos' should appear as a
// in the list
function makeToDos(owner, toDos) {
return {
owner: owner,
toDos: toDos,
generateHtml: function() {
var html = '';
this.toDos.forEach(function(todo) {
html+= '- ' + todo + '
';
});
return html + '
';
}
}
}