最近终于有时间看看新的东西了,刚才在Slideshare上面看了一个PPT,关于JavaScript的,有些地方还是值得一看的,把一些之前没有意识到的地方记录下来先。
- 原作者有个错误,"0"和"0.0"都不是假值,空字符才是假值。
- 0.0 + "0" = "00"。这里是做字符串相加,而0.0转换成字符串是"0"。
- 下面的代码:
var x = 9;
function foo() {
alert(x);
var x = 10;
alert(x);
}
foo();
初一看还以为输出时9和10,其实是undefined和10。这里的关键之处在于理解执行上下文中的激活对象(Activation Object),激活对象是在执行上下文对应的作用域链(scope chain)的第一个对象,它中间除了包含传入的参数的值外,还包含所有的局部变量,并且这些局部变量的值一开始都是undefined。就这个例子来说,在foo被调用的时候,激活对象被创建,x有了值undefined,所以执行第一行的alert的时候,输出undefined;接着x被赋予值10,第二个alert就输出10了。从这点出发,一个好的做法是在使用局部变量前先声明。 更多的细节可以看这篇文章。
- 对于onload的事件,可以在使用之后就删除掉,以释放内存。
分享到:
相关推荐
We would not only explore the IoT solution stack, but we will also see how to do it with the world’s most misunderstood programming language - JavaScript. Using Raspberry Pi 3 and JavaScript (ES5/...
JavaScript FUNdamentals: The Powerful and Misunderstood Language of The Web ##### 1.1 Expressiveness JavaScript 是一种非常灵活的语言,它允许开发者使用简洁而富有表现力的语法来编写代码。例如,你可以...
- misunderstood:误解,理解错误,表示对某事或某人的看法有误。 - statement:陈述,声明,通常指个人的观点或事实的叙述。 - adults:成年人,相对于儿童而言的成熟个体。 - crossroads:十字路口,道路交汇...
Anger: The misunderstood emotion. New York: Simon and Schuster, Touchstone Books, 383 pp., [dollar]9.95 (paper) Book Reviews 87 FEINDLER, E. L., & ECTON, R. B. (1986). Adolescent anger control: ...
- misunderstood(误解)表示清晰表达的重要性,以免引起误会。 - approach(接近)用于描述接近学校时看到的教学楼。 2. 完成句子部分: - with ease(容易地)强调解决问题的轻松。 - In general(总的来说)...
Streams: Node's most powerful and misunderstood feature File system: Synchronous and asynchronous approaches Networking: Node's true "Hello, World" Child processes: Integrating external ...
- 被动形式:"The problem of being misunderstood is common." 2. **动名词的考点**: - 动名词作主语,谓语动词用单数,如:"Eating too much is harmful to health." - 常作为介词的宾语,如:"I'm looking ...
- 误解(misunderstood):动词过去分词,表示理解错误。 - 接近(approach):动词,表示靠近或接近某个地方。 2. 完成句子: - 这些代表约旦的运动员将会参加今年的特奥会。(represent) - 随着春天的来临,...
be misunderstood 95. a",测试综合理解和词汇运用。 8. **课外阅读:简答题**:这部分要求学生阅读一篇课外材料后,回答问题,如Mahir的人物特点分析,这需要学生具备一定的阅读理解能力和批判性思维。 9. **...
- 动词加`-ed`变成过去式或形容词,如`understand`到`misunderstood`,表示“误解”。 3. **构词法在句子中的运用**: - 句子中使用前缀和后缀可以增强表达的准确性和多样性,如`honestly speaking`(老实说)。 ...
讲述SOA设计方法的好书,当初我可是仔细的从头到尾阅读了一遍 "Service Oriented Architecture is a hot, but often misunderstood topic in IT today. Thomas articulately describes the concepts, specifications...
Where concepts are difficult or commonly misunderstood, I will explain in detail how they work and why they behave the way they do. In other chapters, I may not exhaust the topic, but I will give you...
Teams working on the JVM can now say goodbye forever to misunderstood requirements, tedious manual acceptance tests, and out-of-date documentation. Cucumber - the popular, open-source tool that helps ...
Templates are among the most powerful features of C++, but they remain misunderstood and underutilized, even as the C++ language and development community have advanced. In C++ Templates, Second ...
【知识点】 ...同时,这部分内容也强调了英语写作和阅读理解能力的培养,如句子结构的多样性、词汇的准确运用以及上下文理解。通过这样的同步作业和解析,学生能够更好地巩固课堂所学,提升英语综合能力。
Templates are among the most powerful features of C++, but they remain misunderstood and underutilized, even as the C++ language and development community have advanced. In C++ Templates, Second Editi...
- “Similarly, 75 years after its initial discovery, the expansion of the universe is still widely misunderstood.”(同样地,距离最初的发现已经75年了,宇宙的膨胀还是广遭误解。) - **备考提示**:在四...
misunderstood** **含义**: v. 误会; 不理解 **词根词缀分析**: mis-(错误, 否定)+ under-(在下)+ stand(站) **解析**: `misunderstand` 由 `-understand` 和前缀 `mis-` 构成,表示错误的理解或解读,...
- 例句:“It appears that they have misunderstood the instructions.” - _It is clear/important/likely/possible that..._ - 例句:“It is likely that the project will be completed ahead of schedule....