This solution is generated by ChatGPT, correctness is not guaranteed. You might also be able to find a solution fromcommunity posts.
AI solution for JavaScript Quiz on BFE.dev
74. Typed Array length
The code outputs:
3
10
Explanation:
- The first
console.log(arr1.length)statement logs3because theMyArrayclass extendsUint8Arrayand overrides itslengthgetter method to always return3. - The second
console.log(arr2.length)statement logs10because it creates a regularUint8Arrayinstance with a length of 10, and the default implementation oflengthforUint8Arraysimply returns the length of the instance.