I have this inside my html file:
<div class="messages">
<input id="msg" type="text" name="fname">
<input type="submit" onclick="general.add.call()" value="Send">
<input type="submit" onclick="viewMsgs()" value="view messages">
</div>
and in my js file
(function(){
var general = new Channel();
var rich = new Person('Rich');
var rob = new Person('Rob');
var message = new Message(rich, rob, "Hello!");
})()
and above that I have:
class Channel {
constructor() {
this.messages = [];
}
add(msg) {
this.messages.push(msg)
}
why is it saying that general is undefined?
function(){for some reason(function(){...})(), and can't be accessed from outside.