Post History
JavaScript (Node.js), 39 bytes Returns dimensions from innermost to outermost f=a=>a?.pop?f(a[0]).concat(a.length):[] JavaScript (Node.js), 41 bytes Returns dimensions from outermost to ...
Answer
#2: Post edited
# [JavaScript (Node.js)](https://nodejs.org), 49 bytes- Returns dimensions from innermost to outermost
- ```javascript
f=a=>Array.isArray(a)?f(a[0]).concat(a.length):[]- ```
[Try it online!](https://tio.run/##dctBCsIwEIXhvSeZQAwBi4JSxXMMsxhiUishkSQUevrY6k7S1YP/47144mzS@C77EB@2Vtdzf72nxLMa83eBxc0BoyahTAyGC7DyNgzlKc5IdWk5eqt8HMABkhCX3V/TrYjUrnIDOtktpuWhzbjqkTYQT@uXflw/ "JavaScript (Node.js) – Try It Online")- -----
# [JavaScript (Node.js)](https://nodejs.org), 51 bytes- Returns dimensions from outermost to innermost
- ```
f=a=>Array.isArray(a)?[a.length].concat(f(a[0])):[]```[Try it online!](https://tio.run/##dctBCsMgEIXhfU@iYEVIaKElLTnHMIvBmDRFtKgEcnpr2l0wqwffz3vTQlGH@ZPOzg8m57Gj7tGHQKuc428Z8SeQtMZN6YVSe6cpsZERKOT8BpgLRW@NtH4qDkXvp52pGgLWVRyEVrSlKdHUM2z1ggcRrtsX/zl/AQ "JavaScript (Node.js) – Try It Online")
- # [JavaScript (Node.js)](https://nodejs.org), 39 bytes
- Returns dimensions from innermost to outermost
- ```javascript
- f=a=>a?.pop?f(a[0]).concat(a.length):[]
- ```
- -----
- # [JavaScript (Node.js)](https://nodejs.org), 41 bytes
- Returns dimensions from outermost to innermost
- ```
- f=a=>a?.pop?[a.length].concat(f(a[0])):[]
- ```
#1: Initial revision
# [JavaScript (Node.js)](https://nodejs.org), 49 bytes Returns dimensions from innermost to outermost ```javascript f=a=>Array.isArray(a)?f(a[0]).concat(a.length):[] ``` [Try it online!](https://tio.run/##dctBCsIwEIXhvSeZQAwBi4JSxXMMsxhiUishkSQUevrY6k7S1YP/47144mzS@C77EB@2Vtdzf72nxLMa83eBxc0BoyahTAyGC7DyNgzlKc5IdWk5eqt8HMABkhCX3V/TrYjUrnIDOtktpuWhzbjqkTYQT@uXflw/ "JavaScript (Node.js) – Try It Online") ----- # [JavaScript (Node.js)](https://nodejs.org), 51 bytes Returns dimensions from outermost to innermost ``` f=a=>Array.isArray(a)?[a.length].concat(f(a[0])):[] ``` [Try it online!](https://tio.run/##dctBCsMgEIXhfU@iYEVIaKElLTnHMIvBmDRFtKgEcnpr2l0wqwffz3vTQlGH@ZPOzg8m57Gj7tGHQKuc428Z8SeQtMZN6YVSe6cpsZERKOT8BpgLRW@NtH4qDkXvp52pGgLWVRyEVrSlKdHUM2z1ggcRrtsX/zl/AQ "JavaScript (Node.js) – Try It Online")