# Object and Array question

**URL:** <https://forum.kirupa.com/t/object-and-array-question/265200>\
**Category:** flash\
**Created:** [July 5, 2008, 11:32pm UTC](https://forum.kirupa.com/t/object-and-array-question/265200 "2008-07-05T23:32:23Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![dfm\_](https://avatars.discourse-cdn.com/v4/letter/d/3da27b/32.png) [@dfm\_](https://forum.kirupa.com/u/dfm_)\
**Post date:** [July 5, 2008, 11:32pm UTC](https://forum.kirupa.com/t/object-and-array-question/265200/1 "2008-07-05T23:32:23Z")

</div>

**Example**  
The first line of the following code creates an empty object using the object initializer operator; the second line creates a new object using a constructor function.

object = {};  
object = new Object();

ok so to init object as {} is more faster then new Object(), same with Array ([] is more faster then new Array()). My question is is there ant advantages with using constructor function or it is the same?

---

<div class="post-metadata">

**Author:** ![TheCanadian](https://avatars.discourse-cdn.com/v4/letter/t/67e7ee/32.png) [@TheCanadian](https://forum.kirupa.com/u/TheCanadian)\
**Post date:** [July 6, 2008, 5:23am UTC](https://forum.kirupa.com/t/object-and-array-question/265200/2 "2008-07-06T05:23:45Z")

</div>

There’s no difference except for if you want to specify the length of the array when you create an instance; then you need the constructor.

---

<div class="post-metadata">

**Author:** ![dfm\_](https://avatars.discourse-cdn.com/v4/letter/d/3da27b/32.png) [@dfm\_](https://forum.kirupa.com/u/dfm_)\
**Post date:** [July 6, 2008, 11:48am UTC](https://forum.kirupa.com/t/object-and-array-question/265200/3 "2008-07-06T11:48:18Z")

</div>

10x for answer 🙂
