As far as I can see in this situation:
var x = []; var y = {}; y.someProp='asd';
This does not work:
x.push(y);
What I want to do is add the link y to x so that later, if I "delete y;" I want it to be removed from the x array as well.
You mix variables, references, and objects.
Execution delete y;deletes the variable y. Since the variable no longer exists, it naturally will no longer matter. Thus, the link contained in the variable is missing.
delete y;
, , , . , .
. , , . , , .
delete. , , . - " " , - JavaScript.
delete
?
Var x=[{}]; var y=x[0];
: , . : "" ? delete array.splice(), , ?
-, y , , , , , . , -
var x=[]; var y={}; y.arrayIndex=(x.push(y)-1); // later on, you want to get rid of y delete x[y.arrayIndex]; delete y;
: x.push(y);
:
, , , - y .
delete , , , , .
var y = {"someprop":true}; delete y; alert(y.someprop); // alerts "true"
, enter:
javascript:var y = {"someprop":true}; delete y; alert(y.someprop);
Source: https://habr.com/ru/post/1742417/More articles:How to save django object using dictionary? - djangohttps://translate.googleusercontent.com/translate_c?depth=1&pto=aue&rurl=translate.google.com&sl=ru&sp=nmt4&tl=en&u=https://fooobar.com/questions/1742413/using-generics-to-typecast-object-type-to-generic-type&usg=ALkJrhjeCOsnjM-4skNZNpZEUoIt34h_RQhttps://translate.googleusercontent.com/translate_c?depth=1&pto=aue&rurl=translate.google.com&sl=ru&sp=nmt4&tl=en&u=https://fooobar.com/questions/1742414/globally-specifying-username-for-all-mercurial-repositories&usg=ALkJrhheYZcQnWeJg2nAEsF0c1izXz6j9AC # delegate or func for all methods? - genericsRouting in PHP versus routing in Rails - phpDo not return the number of counters for a populated array - arraysResults of two queries at once in sqlite? - c ++Removing Mercury Weapons? - mercurialCrop ads in sharepoint - htmlto make an output rule for files in a folder - makefileAll Articles