U
U
ura2rist2019-11-24 18:02:39
Node.js
ura2rist, 2019-11-24 18:02:39

How to create an object in an array?

for(ot of otds){
          menuOtd.push(ot.name);
          
          if(ot.pndOtd.sub == "true"){
            
          };
        };

I create in a loop - a regular array, but under a certain condition an object should be created, how to do this?
Conditionally, if the variable is equal to true, then not an element of the array "NAME" is created, but an object in which the value of NAME will be and let's say "Description"

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question