N
N
nurdus2018-07-15 09:58:20
JavaScript
nurdus, 2018-07-15 09:58:20

What is better to use as iterable object in vue (generally in js)?

Good afternoon.
Array vs Object? I understand that one can easily be converted to the other. But I would like to hear your opinion based on your experience. :)

// под Object-ом я понимаю следующее
mainNav = {
  create: {
    name: "create",
    title: "Создать",
    active: true
  },
  // ...
}

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Alexander Pushkarev, 2018-07-17
@nurdus

If order is important - Array
If you will access directly without loops - Object
Large lists - Map

S
Stalker_RED, 2018-07-15
@Stalker_RED

An array is a special case of an object to which a number of methods have been added.
96lsJK.pngEBHn6b.png

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question