<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title> New Document </title>
<metaname="Generator" content="EditPlus">
<metaname="Author" content="">
<metaname="Keywords" content="">
<metaname="Description" content="">
</head>
<body>
<divid="demo"></div>
<script>
//Functions are objects, but objects are not functions. Of course you can store functions as object properties but you can't make a plain object "callable". Or what do you actually want to achieve? What should be the advantage of your second approach? – Felix Kling Feb 5 '11 at 12:02
vartest=function(){
console.log(test.data);
//return str;
};
test.str="ab";
console.log(test.str);
testinstanceofObject;
//Javascript type undefined, number, boolean, object, string, function
test.data='hello';
//test.set = function (data) {
// test.data = data;
//};
//test.set('Test');
//test();
//This outputs Test to my javascript console. Now I was wondering, if there was a way to do it using something like this?