TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

For x in JavaScript

7 点作者 TrevorBurnham大约 15 年前

2 条评论

pan69大约 15 年前
If you're new to Javascript/Actionscript/ECMAScript you might think there is a difference between objects (maps) and arrays, but there isn't. An array is simply a map (object) with the properties 0, 1, 2 etc. set to specific values.<p>This will list the properties of the map (0, 1, 2):<p>var a = ['a', 'b', 'c'];<p>for( i in a ) { console.log( i ); }<p>This will list the values of those properties:<p>var a = ['a', 'b', 'c'];<p>for( i in a ) { console.log( a[i] ); }
评论 #1372567 未加载
abdulhaq大约 15 年前
I find it surprising that javascript gets so much traction as a hidden jewel when really it's a pretty poor language compared to python, for instance. It started off being pooh-poohed (including by myself) by those who thought that it was some sort of cut-down 'scripting language' version of Java. Then Douglas Crockford pointed out that you could do closures in Javascript and it became kind of cool to praise Javascript. When I started using it (after programming in C, C++, Lisp, Java, Python, etc.) I discovered an interesting language but too many pain points (after the joy of python coding) to consider it anything special.