<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>哈哈小老虎&#039;s Blog &#187; JS</title>
	<atom:link href="http://www.mytcer.com/tag/js/feed" rel="self" type="application/rss+xml" />
	<link>http://www.mytcer.com</link>
	<description></description>
	<lastBuildDate>Sat, 31 Dec 2011 15:42:15 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3</generator>
		<item>
		<title>学习笔记: JS运算符的优先级</title>
		<link>http://www.mytcer.com/468</link>
		<comments>http://www.mytcer.com/468#comments</comments>
		<pubDate>Sat, 27 Feb 2010 12:24:25 +0000</pubDate>
		<dc:creator>Tcer</dc:creator>
				<category><![CDATA[JS]]></category>
		<category><![CDATA[运算符的优先级]]></category>

		<guid isPermaLink="false">http://www.mytcer.com/?p=468</guid>
		<description><![CDATA[Nicholas C. Zakas的测试题中，有部分是关于JS运算符的, 一番测试下来，发现对运算符的知识点掌握的不够好，所以决定整理下运算符的知识，这篇先整理运算符的优先级。 一. 运算符的优先级（优先级由高到低，相同优先级按照从左到右执行） 二. 尼大叔的测试题 var num1 = 5, num2 = 10, result = num1+++num2; 问题: num1, num2, result的值分别是多少? 说明: +++不是一个有效的运算符, 由于++的优先级要高于+, JS引擎会将+++解释成++ +, 即先执行num1++, 然后再把表达式num1++的值和num2的值相加, 故而三者的值为6, 10, 15.]]></description>
		<wfw:commentRss>http://www.mytcer.com/468/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>关于计时器</title>
		<link>http://www.mytcer.com/129</link>
		<comments>http://www.mytcer.com/129#comments</comments>
		<pubDate>Sun, 29 Nov 2009 09:18:36 +0000</pubDate>
		<dc:creator>Tcer</dc:creator>
				<category><![CDATA[JS]]></category>
		<category><![CDATA[setInterval]]></category>
		<category><![CDATA[setTimeout]]></category>
		<category><![CDATA[计时器]]></category>

		<guid isPermaLink="false">http://www.mytcer.com/?p=129</guid>
		<description><![CDATA[一. 三个知识点 1. 计时器并不是JS语言的一部分，而是浏览器引入的方法和对象的一部分; 2. 在OS上，浏览器的最小延时时间为10ms，在windows上为15ms(注: 据我的测试, 15ms仅针对IE, 其他浏览器可以设置低于15ms的延时, 而不会被忽略); 3. 浏览器可以提供非常小的延迟时间，但其精确度得不到保证(即浏览器不能保证你所指定的精确的时间间歇), 这与浏览器如何处理JS的垃圾回收有关; 二. IE中设置延时的一个例外 IE为setInterval提供的延时时间不能为0, 当setInterval的延时时间为0时，它会转变成setTimeout(仅执行一次回调函数). 解决方法: 可以通过为其提供1ms的延迟来解决这个问题, 由于所有浏览器都能自动向上舍入任何低于最小延时时间的值，所以1ms与0ms是一样的(注: 我认为仅针对IE, 因为15ms的最小延时仅针对IE). 三. setTimeout与setInterval的区别 1. 例子一 setTimeout(func, 15);与setInterval(func, 15); a. setTimeout在延迟15秒后, 执行func, 仅执行一次; b. setInterval每隔15秒执行一次func, 会执行多次. 2. 例子二 setTimeout(function() { function callback() {/* other code */} setTimeout(arguments.callee, 15); }, 15); setInterval(function() { function callback() {/* [...]]]></description>
		<wfw:commentRss>http://www.mytcer.com/129/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>有趣的单线程</title>
		<link>http://www.mytcer.com/116</link>
		<comments>http://www.mytcer.com/116#comments</comments>
		<pubDate>Sun, 29 Nov 2009 08:38:49 +0000</pubDate>
		<dc:creator>Tcer</dc:creator>
				<category><![CDATA[JS]]></category>
		<category><![CDATA[单线程]]></category>

		<guid isPermaLink="false">http://www.mytcer.com/?p=116</guid>
		<description><![CDATA[一. JS的执行特点 源于单线程的特性, JS在一段时间内只能执行一部分代码, 那么, 当有多块代码需要执行时, 就需要排队等候了. 二.单线程与异步事件 1. 什么是异步事件? 异步事件是像鼠标点击、计时器释放、XMLHttpRequest请求完成这样的动作, 由于我们不知道它何时执行, 所以, 可以认为它是不同步的(这些说明只能作为帮助理解的参考, O(∩_∩)O). 2. 异步事件是否会受到单线程的影响? 答案是肯定的: 异步事件也必须排队等候(即异步事件对应的JS回调函数, 也必须排队等候执行, 如何排队则因浏览器而异). 3. setTimeout改善排队状况的例子 &#60;script type="text/javascript"&#62; (function() { var st = +new Date(); function add() { var i, j = 0; for (i=0; i&#60;10000000; i++) { j = j + i; }; if (window.console) {console.log('add : [...]]]></description>
		<wfw:commentRss>http://www.mytcer.com/116/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>数组搜索算法之折半搜索</title>
		<link>http://www.mytcer.com/90</link>
		<comments>http://www.mytcer.com/90#comments</comments>
		<pubDate>Sun, 29 Nov 2009 07:39:43 +0000</pubDate>
		<dc:creator>Tcer</dc:creator>
				<category><![CDATA[JS]]></category>
		<category><![CDATA[二分查找]]></category>
		<category><![CDATA[折半搜索]]></category>

		<guid isPermaLink="false">http://www.mytcer.com/?p=90</guid>
		<description><![CDATA[一. 方法原理 当从一个给定的序列数组arr中, 查找某个特定值value时, 折半搜索法是这样做的: 1. 确定搜索范围的起始点: 起点startIndex = 0, 终点endIndex = arr.length &#8211; 1; 2. 根据起始点来确定一个中间点middle = Math.floor((终点 &#8211; 起点) / 2); 3. 在startIndex &#60; endIndex的前提下, 比较arr[middle]与value的大小: (1) arr[middle] &#60; value 调整搜索范围为数组的后半部分, 即startIndex = middle + 1, endIndex = arr.length -1; (2) arr[middle] &#62; value 调整搜索范围为数组的前半部分, 即startIndex = 0, endIndex = middle &#8211; 1; [...]]]></description>
		<wfw:commentRss>http://www.mytcer.com/90/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

