Skip to content
GitLab
Menu
Why GitLab
Pricing
Contact Sales
Explore
Why GitLab
Pricing
Contact Sales
Explore
Sign in
Get free trial
Changes
Page history
Created $.reshape() (markdown)
authored
Jul 12, 2017
by
arguiot
Show whitespace changes
Inline
Side-by-side
$.reshape().md
0 → 100644
View page @
e73cd13c
# 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:
```
javascript
[
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:
```
javascript
$
.
reshape
(
$
.
range
(
5
),
2
)
// [[0, 1], [2, 3], [4, 5]]
```
----
### ⚠️ Questions?
Don't hesitate to ask your questions ⁉️ in the issue part 😁
\ No newline at end of file