Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problems with a simple Object Oriented Code - Result not Showing Up

Status
Not open for further replies.

Ramones1986

Programmer
Mar 20, 2015
2
0
0
US
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>
 
you need to spell function with an i between the t and the o.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top