<file_sep>
const task = {
  title: 'Buy Milk',
  description: 'go to shop and buy a milk'
};

Object.defineProperty(task, 'toString', {
  value: function() {
    return this.title + ' ' + this.description;
  },
  writable: false,
  configurable: false,
  enumerable: false // if omitted or set to false won't be displayed or iterated over
});

const urgentTask = Object.create(task);
Object.defineProperty(urgentTask, 'toString', {
  value: function() {
    return this.title + ' is urgent';
  },
  writable: false,
  configurable: false,
  enumerable: false
});

console.log(urgentTask.toString()); // Buy Milk is urgent<file_sep>
const Task = require('./task');
const Repo = require('./taskRepository');

let task = new Task(Repo.get(1));

let task1 = new Task({ name: 'Run' });
let task2 = new Task({ name: 'Shop' });
let task3 = new Task({ name: 'Play' });

task.complete();
task1.complete();
task2.save();
task3.save();


<file_sep>
const Task = require('./task');
const taskRepo = require('./taskRepo');
const userRepo = require('./userRepo');
const projectRepo = require('./projectRepo');

let task = new Task(taskRepo.get(1));

const user = userRepo.get(1);
const project = projectRepo.get(1);

task.user = user;
task.project = project;


console.log(task);
task.save();



<file_sep>
const Task = require('./task');
const repoFactory = require('./repoFactory');

let task = new Task(repoFactory.getRepo('task').get(1));

const user = repoFactory.getRepo('user').get(1);
const project = repoFactory.getRepo('project').get(1);

task.user = user;
task.project = project;


console.log(task);
task.save();
<file_sep>
const Task = require('./task');
const repoFactory = require('./repoFactory2');

let task = new Task(repoFactory.task.get(1));

const user = repoFactory.user.get(1);
const project = repoFactory.project.get(1);

task.user = user;
task.project = project;


console.log(task);
task.save();
<file_sep>
## Practical Design Patterns in JavaScript

Author: **<NAME>**

Practiced: **36/57**

Watched: **48/57**
