<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>javascript on adolsai's echo</title><link>https://adolsai.com/tag/javascript/</link><description>Recent content in javascript on adolsai's echo</description><generator>Hugo</generator><language>zh-CN</language><lastBuildDate>Wed, 19 Mar 2014 08:52:18 +0800</lastBuildDate><atom:link href="https://adolsai.com/tag/javascript/index.xml" rel="self" type="application/rss+xml"/><item><title>javascript learning notes——function</title><link>https://adolsai.com/archives/43.html</link><pubDate>Wed, 12 Mar 2014 00:13:00 +0800</pubDate><guid>https://adolsai.com/archives/43.html</guid><description>&lt;p&gt;&lt;strong&gt;函数&lt;/strong&gt;：一次定义，多次执行。js的函数调用还有一个特性，每次调用都会拥有另一个值——本次调用的this值（上下文/context）。函数可以作为对象的一个属性，称为对象的方法。当通过对象调用函数时，该对象就是此次调用的上下文。&lt;/p&gt;&#10;&lt;pre&gt;&lt;code&gt;//在定义的时候递归&#10;var f = function fact(x) {if (x&amp;lt;=1) return 1; else return x*fact(x-1);};&#10;//作为参数传递&#10;data.sort(function(a,b){return a-b;});&#10;//定义后立即使用&#10;var tensquared = (function(x){return x*x}(10));&#10;&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>javascript learning notes——array</title><link>https://adolsai.com/archives/37.html</link><pubDate>Sat, 08 Mar 2014 15:24:00 +0800</pubDate><guid>https://adolsai.com/archives/37.html</guid><description>&lt;p&gt;把数组的笔记写完先&#10;数组继承自Array.prototype中的属性，定义了一套丰富的数组操作函数，对于类数组对象同样有效。&#10;数组是javascript对象的特殊形式，用数字引索来访问数组元素要比访问常规的对象属性快很多。&#10;javascript数组的引索是从零开始的32位数值。对于稠密数组，length即是数组包含的元素个数。对于稀疏数值，length比所有元素的引索都要大。&lt;/p&gt;</description></item><item><title>javascript learning notes——object</title><link>https://adolsai.com/archives/36.html</link><pubDate>Fri, 07 Mar 2014 23:41:00 +0800</pubDate><guid>https://adolsai.com/archives/36.html</guid><description>&lt;p&gt;《javascript权威指南》这本书有点太专业了，今天只是看了对象和数组。&#10;对象：不知道是我之前看的书太少还是js的对象实在很特别。我感觉js里面的对象和其他语言里面的用法差了很远。&#10;除了字符串、数字、true、false、null和undefined之外，js中的值都是对象&#10;对象是可变的，是通过引用来操作对象的，对象的属性可以变动，甚至还有属性的特性(writable\enumerable\configurable)&#10;对象都拥有的三个相关的对象属性(protoype\class\extensible flag)&#10;三类对象(native obj\host obj\user-defined obj)，两类属性(own property\inherited property)&lt;/p&gt;</description></item></channel></rss>