Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 31 additions & 11 deletions App.js
Original file line number Diff line number Diff line change
@@ -1,18 +1,21 @@
class NotesApplication {
let list = [];
/**
* get the author
* get the list
* @param author
* @property noteList
*/
constructor(author) {
this.authors = author;
this.list = noteList;
this.list = [];
this.author = author;
let noteList = this.list;
}

/**
* creating a function to take the note_cotent argument
* @params note_content
*/
function create(note_content) {
createIt(note_content) {
this.list.push(note_content);
return this.list;
}
Expand All @@ -21,50 +24,67 @@ class NotesApplication {
* function for listing out the notes in the list
*/

function listNotes() {
listNotes() {

for(let i = 0; i < this.list.length; i++) {
return `Note ID: ${i}
${this.list[i]}

By Author ${author}`;
By Author ${this.author}`;
}
}

/**
* function for get the note with the pass argument of note_id
* @param note_id
*/

function get(note_id) {
getIt(note_id) {
return this.list[note_id];
}

/**
* searching the list by index to find related test
* @param search_text
*/

function search(search_text) {
return "Showing results for " + search_text;
search(search_text) {
console.log("Showing results for " + search_text);

for(let i = 0; i<=this.list.length; i++) {
if(this.list[i].search(search_text)) {
return `Note ID: ${i}
${this.list[i]}

By Author ${author}`;
By Author ${this.author}`;
}
}
}

/**
* deleting the list by using the note id
* @param note_id
*/

function delete(note_id) {
deleteIt(note_id) {
let indexCheck = this.list[note_id];
if(indexCheck > -1) {
this.list.splice(indexCheck, 1);
}
}

/**
* function to edit the note by searching for the index
* @param note_id
* @param new_content
*/
edit(note_id, new_content) {
if(note_id < this.list.length) {
this.list[note_id] = new_content;
console.log(this.list[note_id]);
}else{
console.log("This would not work unless you type the number from 0" + this.list.length);
}
}

}