From 4b49373385788cd9e461b43e6b35c378c1176524 Mon Sep 17 00:00:00 2001 From: krahets Date: Mon, 13 Feb 2023 16:29:31 +0800 Subject: [PATCH] Update index.md, hashmap.md --- docs/chapter_hashing/hash_map.md | 19 +++++++++---------- docs/index.md | 7 ++++++- 2 files changed, 15 insertions(+), 11 deletions(-) diff --git a/docs/chapter_hashing/hash_map.md b/docs/chapter_hashing/hash_map.md index 865a0e6f2..0985a8fa2 100755 --- a/docs/chapter_hashing/hash_map.md +++ b/docs/chapter_hashing/hash_map.md @@ -311,18 +311,17 @@ comments: true ```javascript title="hash_map.js" /* 遍历哈希表 */ - // 遍历键值对 key->value - for (const entry of map.entries()) { - if (!entry) continue; - console.info(entry.key + ' -> ' + entry.val); + console.info('\n遍历键值对 Key->Value'); + for (const [k, v] of map.entries()) { + console.info(k + ' -> ' + v); } - // 单独遍历键 key - for (const key of map.keys()) { - console.info(key); + console.info('\n单独遍历键 Key'); + for (const k of map.keys()) { + console.info(k); } - // 单独遍历值 value - for (const val of map.values()) { - console.info(val); + console.info('\n单独遍历值 Value'); + for (const v of map.values()) { + console.info(v); } ``` diff --git a/docs/index.md b/docs/index.md index f0637c1c7..ae7d57a55 100644 --- a/docs/index.md +++ b/docs/index.md @@ -58,6 +58,12 @@ hide:

推荐语

+!!! quote + + “如果我当年学数据结构与算法的时候有《Hello 算法》,学起来应该会简单10倍!” + + **—— 李沐,亚马逊资深首席科学家** + !!! quote “一本通俗易懂的数据结构与算法入门书,引导读者手脑并用地学习,强烈推荐算法初学者阅读。” @@ -79,7 +85,6 @@ hide:
-
justin-tse
justin-tse

JS / TS
krahets
krahets

Java / Python
nuomi1
nuomi1

Swift