Answer the question
In order to leave comments, you need to log in
How to overload metamethods in JS?
In Lua, objects have metatables that contain metamethods - functions called when working with objects, in fact, these are object methods, for example, adding a new element to an array, these metamethods can be overloaded ... It is interesting that there are metamethods that are not called only when a method or property of an object is explicitly called, but also with some other events, such as object initialization, access to an array element, etc... In JS, I need to catch the moment when a value is added to the array, not only through the method (s)
var arr = [];
arr.push("string");
var arr = [];
arr[1] = "string";
Answer the question
In order to leave comments, you need to log in
Proxy - this is so that you can process
arr[1] = "string"
catch and overload methods
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question