Skip to content

$.reshape()

Arthur Guiot edited this page Jul 12, 2017 · 1 revision

How it works?

This function is made to create a 2d array from a 1d array. Basically, this function is made to do something like:

[0, 1, 2, 3, 4, 5]
//       |  Break into parts of 2
//       V
[[0, 1], [2, 3], [4, 5]]

How to use it?

This function requires 2 arguments, which are:

  • array, the 1d array
  • parts, in parts of what the array will break into

Example

Let's do what I showed you before:

JS:

$.reshape($.range(5), 2) // [[0, 1], [2, 3], [4, 5]]

⚠️ Questions?

Don't hesitate to ask your questions ⁉️ in the issue part 😁

Clone this wiki locally