-1

Exception thrown on console. Why this exception is been thrown? After this exception is thrown, onchange dropdown does not work anymore. What can I do to prevent this from happening

Uncaught TypeError: Object function () {
    if (this instanceof String) {
        if (this.indexOf("%") != -1) {
            return this;
        }
    }
    return this + "px";
} has no method 'push' 

Method in Javascript

Object.prototype.measurement = function() {
    if (this instanceof String) {
        if (this.indexOf("%") != -1) {
            return this;
        }
    }
    return this + "px";
};

Link to code

java_dude
  • 4,038
  • 9
  • 36
  • 61

1 Answers1

0

The problem was solved by changing function definition from

Object.prototype.measurement = function() {} 

to

function measurement(position) {} 
Anto Jurković
  • 11,188
  • 2
  • 29
  • 42
java_dude
  • 4,038
  • 9
  • 36
  • 61