May 2018
Intermediate to advanced
492 pages
12h 3m
English
Create a directory named models, as a sibling of the views and routes directories.
Then, create a file named Note.js in that directory, and put this code in it:
const _note_key = Symbol('key');const _note_title = Symbol('title');const _note_body = Symbol('body');module.exports = class Note { constructor(key, title, body) { this[_note_key] = key; this[_note_title] = title; this[_note_body] = body; } get key() { return this[_note_key]; } get title() { return this[_note_title]; } set title(newTitle) { this[_note_title] = newTitle; } get body() { return this[_note_body]; } set body(newBody) { this[_note_body] = newBody; }};
This defines a new class, Note, for use within our Notes application. The intent is to hold ...
Read now
Unlock full access