#539·quickjs

`TypeError` with code like `[1,2,3].values().map(n=>n).take(2).toArray()`

Author: haijinSkCreated Jul 13, 2026Updated Jul 13, 2026

On Ubuntu, QuickJS version 2026-06-04, in a precompiled file: https://bellard.org/quickjs/binary_releases/quickjs-linux-x86_64-2026-06-04.zip

The unexpected error (at least for me):

qjs > [1,2,3].values().map(n=>n).take(2).toArray()
TypeError: not a function
    at return (native)
    at toArray (native)
    at <eval> (<evalScript>:1:43)

But this (for example) as expected:

qjs > [1,2,3].values().map(n=>n).take(4).toArray()
[ 1, 2, 3 ]

Yes, of course, for a small finite array I don't need to use .values() and .take() and it seems to work if the iterator's values are produced by yield.

I'm new to JavaScript (and only a naive user/learner of some programming languages), but I was recently inspired by QuickJS to start learning modern JavaScript.

Thank you.