Skip to content

Instantly share code, notes, and snippets.

@mbildner
Created February 28, 2014 00:22
Show Gist options
  • Save mbildner/9262658 to your computer and use it in GitHub Desktop.
Save mbildner/9262658 to your computer and use it in GitHub Desktop.
operator overloading js
<html>
<head>
<title></title>
</head>
<body>
<script>
function Person (first, last) {
this.first = first;
this.last = last;
this.toString = function () {
var greeting = "hello from " + this.first + " " + this.last;
alert(greeting);
};
};
var moshe = new Person('moshe', 'bildner');
+moshe;
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment