Ramones1986
Programmer
Hey guys -
First post here.
I'm learning Object Oriented Programming in Javascript. I feel like I'm understanding it - but I have a code snippet below that is not showing the result. When I run it - it's giving me nothing. I ran it through a "javascript syntax" checker - but it didn't see anything wrong. Just curious if someone could look at it and see if there is any adjustments I should be making:
<script>
function exampleClass() {
this.property1 = 5;
this.property2 = "world";
this.method1 = functon method1(arg1) {
return arg1+" "+this.property2;
}
}
var instance1 = new exampleClass();
var instance2 = new exampleClass();
alert(instance1.method1("Hello") );
</script>
First post here.
I'm learning Object Oriented Programming in Javascript. I feel like I'm understanding it - but I have a code snippet below that is not showing the result. When I run it - it's giving me nothing. I ran it through a "javascript syntax" checker - but it didn't see anything wrong. Just curious if someone could look at it and see if there is any adjustments I should be making:
<script>
function exampleClass() {
this.property1 = 5;
this.property2 = "world";
this.method1 = functon method1(arg1) {
return arg1+" "+this.property2;
}
}
var instance1 = new exampleClass();
var instance2 = new exampleClass();
alert(instance1.method1("Hello") );
</script>