mirror of
https://github.com/krahets/hello-algo.git
synced 2026-10-20 21:15:19 +08:00
Add JavaScript and TypeScript code of top_k and update some code style (#686)
* Update JS and TS code style * Add JavaScript and TypeScript code of top_k * Update top_k.ts * Apply suggestions from code review Co-authored-by: Justin Tse <[email protected]> * Apply suggestions from code review Co-authored-by: Justin Tse <[email protected]> --------- Co-authored-by: Yudong Jin <[email protected]>
This commit is contained in:
co-authored by
Justin Tse
Yudong Jin
parent
4c75c204f3
commit
5d7e0a59b1
@@ -53,7 +53,7 @@ function traverse(nums) {
|
||||
count++;
|
||||
}
|
||||
// 直接遍历数组
|
||||
for (let num of nums) {
|
||||
for (const num of nums) {
|
||||
count += 1;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user