Anubhav Tiwari Anubhav Tiwari - 1 month ago 11x
Javascript Question

Why is the function undefined?

var devigner = window.devigner = {};
devigner.create = function() { /*a generic method to create elements */
var element = function() {


The above code has an error for document.create.element being undefined while the typeof devigner is object which is correct , but typeof devigner.create is function.

when run in firebug


You need to do the function:


Also, create function should return an object with an 'element' value

create = function() {
    var element = ....
    return {element: element}