fix(docs/mapping-types): fix wrong demo code.

get index before push, so the access of this index won't beyond the boundery.
This commit is contained in:
KaiYu Feng
2020-05-01 00:14:45 +08:00
committed by GitHub
parent 602b29cba7
commit 15748e871e
+1 -1
View File
@@ -138,8 +138,8 @@ the ``sum`` function iterates over to sum all the values.
if (keyIndex > 0)
return true;
else {
self.keys.push();
keyIndex = self.keys.length;
self.keys.push();
self.data[key].keyIndex = keyIndex + 1;
self.keys[keyIndex].key = key;
self.size++;