class note{
	constructor(noteContent, author){
		this.author = author;
		this.noteContent = noteContent;
	}
}//constructor class created for creating note objects
class Notesapplication {
	constructor(author){
		this.author = author;
		this.notes =[];
	}
	create(noteContent){
		var noteObject =  new note (noteContent, this.author);
		this.notes.push(noteObject);
		//this pushes the new noteObject created with notecontent into the notes array
	}
	listNotes(){
		for (var i= 0;i<this.notes.length;++i){
			console.log("Note ID:"+i);
			console.log(this.notes[i].noteContent);
			console.log("By Author:"+this.notes[i].author);
		}}// this prints out listNotes
	get(noteId){
		return this.notes[noteId].noteContent;
	}// this returns notecontent based on id
	
	search(searchText){
		console.log("showing results for searchText:"+ searchText);
		for(var i= 0 ; i <this.notes.length; i++){
			if (this.notes[i].noteContent.indexOf(searchText)>-1) {
			console.log("Note ID:"+i);
			console.log(this.notes[i].noteContent);
			console.log("By Author:"+this.notes[i].author);} 
			else console.log(searchText+" not found in "+this.notes[i].noteContent)
		}
	}
	delete(noteId){
		 this.notes.splice(noteId);
		//this.notes[noteId] = "";
	}
	
	edit(noteId,newContent){
		this.notes[noteId].noteContent = newContent;}
}
var sani = new Notesapplication("Bammi");
	sani.create("bammi is a fool");
	sani.create("bammi is a buffoon");
	//sani.listNotes();
	//sani.get(0);
	sani.search("is");
	//sani.delete(1);
	//sani.listNotes();
	//sani.edit(0,"Now you are a big buffoon");
	//sani.listNotes();
	