Files
codeql/javascript/ql/src/LanguageFeatures/examples/EvalGood.js
2018-08-02 17:53:23 +01:00

15 lines
282 B
JavaScript

function Point(x, y) {
this.x = x;
this.y = y;
}
["x", "y"].forEach(function(p) {
Point.prototype["get_" + p] = function() {
return this[p];
};
Point.prototype["set_" + p] = function(v) {
if (typeof v !== 'number')
throw Error('number expected');
this[p] = v;
};
});