Tag

Object.keys

1 views collected around this technical thread.

Code Mala Tang
Code Mala Tang
Sep 5, 2024 · Frontend Development

Why Object.keys Fails in TypeScript and How to Fix It

This article explains why iterating over object keys with Object.keys in TypeScript often yields unexpected results, analyzes the underlying type‑system reasons, and presents four practical solutions—including type assertions, type predicates, generic functions, and wrapper utilities—to reliably access object properties.

Object.keysTypeScriptgeneric function
0 likes · 6 min read
Why Object.keys Fails in TypeScript and How to Fix It
IT Xianyu
IT Xianyu
Feb 18, 2022 · Frontend Development

Understanding Object.keys Order and V8 Property Handling to Fix a wxml2canvas Bug

This article explains why a WeChat mini‑program’s share card lost its QR code due to incorrect assumptions about Object.keys ordering, dives into the ECMAScript specification and V8’s internal property storage, and shows how to modify wxml2canvas to correctly sort elements and avoid the bug.

JavaScriptObject.keysV8
0 likes · 19 min read
Understanding Object.keys Order and V8 Property Handling to Fix a wxml2canvas Bug
WeDoctor Frontend Technology
WeDoctor Frontend Technology
Jul 21, 2021 · Frontend Development

7 JavaScript Object Traversal Techniques Illustrated with Allen Iverson

This article examines seven ways to iterate over JavaScript objects—excluding arrays, Map, and Set—using a sample player object modeled after Allen Iverson, detailing each method’s handling of own, inherited, enumerable, non‑enumerable, and Symbol properties, with code examples and output analysis.

JavaScriptObject TraversalObject.keys
0 likes · 9 min read
7 JavaScript Object Traversal Techniques Illustrated with Allen Iverson
Tencent IMWeb Frontend Team
Tencent IMWeb Frontend Team
Mar 15, 2021 · Frontend Development

Why Object.keys() Doesn’t Preserve Insertion Order: A Deep Dive into JavaScript Engine Sorting

This article investigates why JavaScript's Object.keys() may return keys in an unexpected order, explains the specification‑defined sorting rules for integer and string properties, demonstrates the issue with timestamp tags on iOS and Android, and explores the actual implementations in QuickJS and V8 engines.

JavaScriptObject.keysQuickJS
0 likes · 16 min read
Why Object.keys() Doesn’t Preserve Insertion Order: A Deep Dive into JavaScript Engine Sorting