I'm just starting to learn javascript, so please bear with me. If functions are just another class of objects, why can't I create new properties or methods for a user-defined function and reference them using the dot (.) operator. For example, if I have function defined as:
function test(tagvalue)
{
var elem = document.querySelectorAll('[data-mytag=' + tagvalue + ']')[0];
this.id = elem.id;
}
Why can't I simply call the function as: var x = test('abc').id;