Logo

Programming-Idioms

History of Idiom 27 > diff from v27 to v28

Edit summary for version 28 by glmdgrielson:
New JS implementation by user [glmdgrielson]

Version 27

2018-05-08, 01:34:15

Version 28

2018-05-21, 23:18:09

Idiom #27 Create a 3-dimensional array

Declare and initialize a 3D array x, having dimensions boundaries m, n, p, and containing real numbers.

Illustration

Idiom #27 Create a 3-dimensional array

Declare and initialize a 3D array x, having dimensions boundaries m, n, p, and containing real numbers.

Illustration
Code
var x = 
    [].fill(
        [].fill(
            [].fill(0, 0, p),
            0,
            n
        ),
        0,
        m
    );
Doc URL
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/fill