as a beginner I tried to use classes in JavaScript because I started to learn programming with C#.
So i want to store a note (with a title and a text) to a data store. These are my small classes:
class Note{ // The single note
constructor(noteTitle, noteText) { // set the notes title and text
title = noteTitle;
text = noteText;
}
var title;
var text;
}
class Notestore{
var notes = []; // stores all the notes
function AddNote(note){
notes.push(note); // add a new note to the list
}
}
class NoteController{
var store = new NoteStore(); // get the reference to the store
function CreateNote(title, text){ // create a new note and store it
store.AddNote(new Note(title, text));
}
}
So when I start the application it says,
var store = new NoteStore();
is not defined. My NoteController is the first class getting called. What do I have to change, that my classes should work =?
Thanks for help!