# How to split an array without split node

**URL:** https://discourse.nodered.org/t/how-to-split-an-array-without-split-node/43543
**Category:** General
**Created:** [2 April 2021 10:34 UTC](https://discourse.nodered.org/t/how-to-split-an-array-without-split-node/43543 "2021-04-02T10:34:23Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![ivexy24](https://avatars.discourse-cdn.com/v4/letter/i/df705f/32.png) [@ivexy24](https://discourse.nodered.org/u/ivexy24)
#### Post date: [2 April 2021 10:34 UTC](https://discourse.nodered.org/t/how-to-split-an-array-without-split-node/43543/1 "2021-04-02T10:34:23Z")

</div>

I want to know how can I split an array without having to use the split node. I want to do it in the javascript file of my custom node.Thanks

---

<div class="post-metadata">

### Author: ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)
#### Post date: [2 April 2021 10:46 UTC](https://discourse.nodered.org/t/how-to-split-an-array-without-split-node/43543/2 "2021-04-02T10:46:53Z")

</div>

An array is already split kinda.

Is your question "I want to send a msg for each element of an array"?

---

<div class="post-metadata">

### Author: ![ivexy24](https://avatars.discourse-cdn.com/v4/letter/i/df705f/32.png) [@ivexy24](https://discourse.nodered.org/u/ivexy24)
#### Post date: [2 April 2021 10:47 UTC](https://discourse.nodered.org/t/how-to-split-an-array-without-split-node/43543/3 "2021-04-02T10:47:11Z")

</div>

Yeah.Exactly that!

---

<div class="post-metadata">

### Author: ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)
#### Post date: [2 April 2021 10:48 UTC](https://discourse.nodered.org/t/how-to-split-an-array-without-split-node/43543/4 "2021-04-02T10:48:57Z")

</div>

loop the array, make a `msg` object, send it...

```auto
for (let i = 0; i < arr.length; i++) {
   var m = { payload: arr[i] };
   node.send(m); //or send(m)
}

```

---

<div class="post-metadata">

### Author: ![ivexy24](https://avatars.discourse-cdn.com/v4/letter/i/df705f/32.png) [@ivexy24](https://discourse.nodered.org/u/ivexy24)
#### Post date: [2 April 2021 10:52 UTC](https://discourse.nodered.org/t/how-to-split-an-array-without-split-node/43543/5 "2021-04-02T10:52:16Z")

</div>

Thank you.

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)
#### Post date: [16 April 2021 10:52 UTC](https://discourse.nodered.org/t/how-to-split-an-array-without-split-node/43543/6 "2021-04-16T10:52:17Z")

</div>

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.
