JavaScript中typeof、toString、instanceof、constructor与in
JavaScript 是一种弱类型或者说动态语言。这意味着你不用提前声明变量的类型,在程序运行过程中,类型会被自动确定。
这也意味着你可以使用同一个变量保存不同类型的数据。
最新的 ECMAScript 标准定义了 7 种数据类型:
7种内置类型:Boolean、Null、Undefined、Number、String、Symbol (ECMAScript 6 新定义)和Object,除 Object 以外的所有类型都是不可变的(值本身无法被改变)。
一、typeof
typeof操作符返回一个字符串,表示未经求值的操作数(unevaluated operand)的类型。查看在线代码:
// Numbers
typeof 37 === 'number';
typeof 3.14 === 'number';
typeof Math.LN2 === 'number';
typeof Infinity === 'number';
typeof NaN === 'number'; // 尽管NaN是"Not-A-Number"的缩写,意思是"不是一个数字"
typeof Number(1) === 'number'; // 不要这样使用! // Strings
typeof "" === 'string';
typeof "bla" === 'string';
typeof (typeof 1) === 'string'; // typeof返回的肯定是一个字符串
typeof String("abc") === 'string'; // 不要这样使用! // Booleans
typeof true === 'boolean';
typeof false === 'boolean';
typeof Boolean(true) === 'boolean'; // 不要这样使用! // Symbols
typeof Symbol() === 'symbol';
typeof Symbol('foo') === 'symbol';
typeof Symbol.iterator === 'symbol'; // Undefined
typeof undefined === 'undefined';
typeof blabla === 'undefined'; // 一个未定义的变量,或者一个定义了却未赋初值的变量 // Objects
typeof {a:1} === 'object';
// 使用Array.isArray或者Object.prototype.toString.call方法可以从基本的对象中区分出数组类型
typeof [1, 2, 4] === 'object';
typeof new Date() === 'object';
// 下面的容易令人迷惑,不要这样使用!
typeof new Boolean(true) === 'object';
typeof new Number(1) === 'object';
typeof new String("abc") === 'object';
// 从JavaScript一开始出现就是这样的
typeof null === 'object';
// 正则表达式
typeof /s/ === 'object'; // Chrome 12+ , 符合 ECMAScript 5.1
typeof /s/ === 'object'; // Firefox 5+ , 符合 ECMAScript 5.1 // 函数
typeof function(){} === 'function';
typeof Math.sin === 'function';
typeof /s/ === 'function'; // Chrome 1-12 , 不符合 ECMAScript 5.1
undefined(未赋值)和undeclared(未声明)是有区别的。
检查全局变量的是否声明的安全防范机制:
typeof DEBUG == "undefined"
//或
window.DEBUG
二、toString
可以通过使用toString.call(obj)来检测对象类型。
可以用来检测Object、Number、Array、Date、Function、String、Boolean、Error和RegExp。
下面的代码与上面的代码做了一一比较,其中在注释中有标红的“不同”,说明有区别。查看在线代码:
var toString = Object.prototype.toString;
// Numbers 都返回[object Number]
toString.call(37);
toString.call(3.14);
toString.call(Math.LN2);
toString.call(Infinity);
toString.call(Number(1)); // Strings 都返回[object String]
toString.call("");
toString.call("bla");
toString.call(String("abc")); // Booleans 都返回[object Boolean]
toString.call(true);
toString.call(false);
toString.call(Boolean(true)); // Symbols 都返回[object Symbol]
toString.call(Symbol());
toString.call(Symbol('foo'));
toString.call(Symbol.iterator); // Undefined 都返回[object Undefined]
toString.call(undefined);
//toString.call(blabla);//不同 一个未定义的变量会报错 // Objects
toString.call({a:1});//[object Object]
toString.call([1, 2, 4]);//[object Array] 不同
toString.call(new Date());//[object Date] 不同
toString.call(new Boolean(true));//[object Boolean] 不同
toString.call(new Number(1));//[object Number] 不同
toString.call(new String("abc"));//[object String] 不同
toString.call(null);//[object Null] 不同
toString.call(/s/);//[object RegExp] 不同
toString.call(new TypeError());//[object Error] 不同 // 函数 都返回[object Function]
toString.call(function(){});
toString.call(Math.sin);
三、instanceof
instanceof 运算符可以用来判断某个构造函数的 prototype 属性是否存在另外一个要检测对象的原型链上,返回boolean值。语法如下:
aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAAngAAAA2CAIAAADbOHNYAAAIOElEQVR4nO3dz2vafhzH8f2DySGfgzk0h7YHPdiDHmah68EdRJBB6CE9yGCXURBKi1gGIgilRSxioS0UQSqiYIU6qASS276HxCRq7OxYtn6/3+ebx2WSfvyYSF75/Gj37gdFURRFUZHVu7/dAYqiKIr6LxdBS1EURVERFkFLURRFURHWO9OyAQBAFAhaAAAiRNACABAhghYAgAgRtAAARIigBQAgQgQtAAARImgBAIgQQQsAQIQIWgAAIkTQAgAQIY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Pwna4I7ZuV3H3gbgwFZn92AhJFmNpfXqXHStv+t4cn2UjQux8I7jmy/uRnHtg9FwX5zbFdwtbc5GrsFzsrFbvAyu1D7dFtOacyHcJfP57cSBI9tGQpVkNZYuXt5X9/yrHN7D8MatQTWf9E64970KbrMCgLfsj/0JxhWTqAAA/KdFGrSD04+6M0PYOc4os0k/AAD+P6Id0c7+EMTS9CMAAP8P/O89AABEiKAFACBCBC0AABEiaAEAiBBBCwBAhAhaAAAiRNACABAhghYAgAgRtAAARIigBQAgQgQtAAARImgBAIgQQQsAQIQIWgAAIkTQAgAQIYIWAIAIEbQAAETox48f735QFEVRFBVZ/QP9jJ6fLZgDwwAAAABJRU5ErkJggg==" alt="" />
也就比对object.__proto__与constructor.prototype是否对应。
JavaScript instanceof 运算符代码,参考自《JavaScript instanceof 运算符深入剖析》
function instance_of(L, R) {//L 表示左表达式,R 表示右表达式
var O = R.prototype;// 取 R 的显示原型
L = L.__proto__;// 取 L 的隐式原型
while (true) {
if (L === null)
return false;
if (O === L)// 这里重点:当 O 严格等于 L 时,返回 true
return true;
L = L.__proto__;
}
}
object:要检测的对象,constructor:某个构造函数。查看在线代码:
// 定义构造函数
function C(){}
function D(){} var o = new C();
o instanceof C; // true,因为 Object.getPrototypeOf(o) === C.prototype
//o.__proto__={}; //改变o原型链,o instanceof C将会返回false
o instanceof D; // false,因为 D.prototype不在o的原型链上
o instanceof Object; // true,因为Object.prototype.isPrototypeOf(o)返回true
C.prototype instanceof Object // true,同上 C.prototype = {};
var o2 = new C();
o2 instanceof C; // true
o instanceof C; // false,C.prototype指向了一个空对象,这个空对象不在o的原型链上. D.prototype = new C(); // 继承
var o3 = new D();
o3 instanceof D; // true
o3 instanceof C; // true
有两种方式可以将"o instanceof C"返回“false”:
1、注意上面代码的第12行,改变了函数C.prototype属性,改变之后导致这个对象不在o的原型链上。
2、改变对象o的原型链,借助于非标准的__proto__魔法属性可以实现。比如代码的第7行执行o.__proto__ = {}。
这里需要注意一个地方,就是Object.prototype.isPrototypeOf()与instanceof的区别。请看下面的代码:
var human = function() {}
var socrates = Object.create(human);
console.log(human.isPrototypeOf(socrates)); // true
console.log(socrates instanceof human); // false
console.log(socrates.__proto__ == human.prototype);//false
console.log(socrates.__proto__ == human);//true
上面的Object.create()传递的是human函数,“socrates.__proto__ == human.prototype”不相等,
也就是说human.prototype不在socrates的原型链上,所以instanceof返回的是false。
isPrototypeOf() 是指测试一个对象是否存在于另一个对象的原型链上;现在human这个对象在socrates的原型链上。
四、constructor
constructor返回一个指向创建了该对象原型的函数引用。
需要注意的是,该属性的值是那个函数本身,而不是一个包含函数名称的字符串。对于原始值(如1,true 或 "test"),该属性为只读。
所有对象都会从它的原型上继承一个 constructor 属性。查看在线代码。
1、在JavaScript的继承中,instanceof和constructor表现的是不一样的:
function C(){}
function D(){}
D.prototype = new C(); // 继承
var o = new D();
o instanceof D; // true
o instanceof C; // true
o.constructor == D; // false
o.constructor == C; // true
o.constructor == D.prototype.constructor;//true
o.constructor == Object.prototype.constructor;// false
对象的constructor属性是根据函数的prototype.constructor来的。
2、改变这个对象的constructor属性的值,只有 true, 1 和 "test" 的不受影响,其他的都变成了"function type(){}"
function Type() { };
var types = [
new Array,
[],
new Boolean,
true, // remains unchanged
new Date,
new Error,
new Function,
function(){},
Math,
new Number,
1, // remains unchanged
new Object,
{},
new RegExp,
/(?:)/,
new String,
"test" // remains unchanged
];
for(var i = 0; i < types.length; i++) {
types[i].constructor = Type;
types[i] = [ types[i].constructor, types[i] instanceof Type, types[i].toString() ];
console.log(types[i]);
};
下图分别是“new Boolean” 和 “true”的打印结果:
aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAAPwAAACyCAIAAADpmzUsAAAgAElEQVR4nO2d/VMbR57//Q/kh8257uqukkrxA5W7Ku/xvbpzOUUlt1v25taVbHyOl01ufcvtJtiYxDybZ4wxxDwEBz8EFog3tmMejIUxNgQMBoORESALkASIByEJCQmQ0NOgp9GM5qG/PzQZjyWBhY1sHM2r9INn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axIdAUPXN7zqpCfKVMYuTk9WmXcc0xzzjPvFKul2xrEQqFVVVVAAC9Xp+Wlmaz2YA/2VkslqSkJIvliRdHq1Sq6Ojo8PDwsLCwgwcPWiwWmqYrKip6e3txHC8vL2fGBnxFn5GRUV1dXVpa6na7S0tLOdFvlm3UkWVET5HUVPMsolndzqKnabqsrCzsJ3bt2gXDjEBEj+N4VlYWjMvZV2dmZr7++muVStXS0kL/ZAPyytBkMh08ePDSpUsEQeA4npeXx4U3m2UbDVnK25WmWQsAwDqPSK5NEi7CV/Q0Rc+2KtR8LUVQbsQ9UiOBK0sIlBBfmVj9yaewXrLAeWp4w8TW8JDH4125cgUEJnoMw1JTU7u7u91ud11dXVRUFLyKomhhYWFNTY1Go2ES+3ZkS0tL7969S5Ikn88/evQo15HdLNtocgr2R6HNxrniAuuMyeB2fLxedi/9QX/BoF6ywpxnFhbCjux6yQLkqaIfHR3Ny8vD8bVnk8lkiYmJDocjwPBmaGgoMjIyIiKiuLg4Li6OudrW1paRkcFkC/zp2GQywY4y7DywL3GiD4TtJXoY3oQsLpfr7NmzYrGYfXJTOuZEHwhBFz3bTA8/o5ekXmegLT7Yovca2exM6RWUCZlV58wnGF3eQCgtLY2MjGxvb6efNPUHOOvETU4FzjZq6Tk4Xgw7Vjk4QgyupecIOTjRc4QcnOg5Qo7/D6aTJNX7TxnFAAAAAElFTkSuQmCC" alt="" />
五、in
in操作,如果指定的属性在指定的对象中会返回true,语法如下:
aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAAiEAAAAyCAIAAAAFqJzMAAAMaElEQVR4nO2dX0/bWBrG+STzTfYj2Bf2Bb7AN6m06QWVFkfClQa0S6tt0DbVDEFN2KXVVHNTloJKss0WFRgKI6aISchCu4LuhGWSTSdkJmSaRM6xr2Yvju3Y+eOQkIChT3Q0mtjnPP6d1855/B4fl4FSuYKCgoKCgtKPMkBUjRalSsz/tiqlcsVhr3Nb697GmlS5lUIrNjCDGcxgBrObmQccjtS4q7EPz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IYomp7MyJj3tdnYmMCXYH26s1im7myQmJWvkHfyKnFSqmSFoQd5TEfvr4/r68rM1aXdZ7HaETN68veWME7/iyuEx69HJeGeJ5heU4cC2/nG9ranvkr1cJBlK4rs0796Wf/94JQdyKIqpGTrYAxA1ZbV9YQcOrl9PoZuj27MC218pgR9iE9ifZp1cYz2/tfTtfKnc54gBnM14m5uccoxjsfdY3b9sFsTrfoz04uJDpmnXMyW5t/8sy2ybQrwnwV4wxmMF9b5oFSudK0pJ6PMl9+32rvGUtPRFAuqxzMj3LiXxOXjYGCgnJ1yxnXlXXpZvZ1ZZef5UH5LMrGqi3r25puZ4YylKHsTuUmHuPQoFSuOOzteR/MzK6tMpjBDGYwg9mFzL3598rqpvmaSrnNgcEMZjCDGcz9Zj6Tx5gbrUdqrOlsaNZdjdV6HncwgxnMYAbzpTMP1NVz5uj6SA6ydHujsnOfwQxmMIMZzO5nvui/g9mqjjufVoEZzGAGM5j7Pld2JaIDZShDGcpQdpsyPAbKUIYylKF8XTym1SyeO6MDZjCDGcxgPpfHKBf1V52hDGUoQxnKn5pyf/MYpYUr9sOBwQxmMIMZzG5j7v79mD5Fh1pfXZMulMEMZjCDGcyXztyX9/ydA+GgXKfT2+iAGcxgBjOYL5i5yTuYXfShf9FxbgtmMIMZzGB2M3Nfnsd07ZMOyg7NwQxmMIMZzO5kbvm3ls/Thz5Fp1WMwAxmMIMZzO5k7n0e45w3uTw6YAYzmMEM5h4yX5m5sr7GHcxgBjOYwdwP5oHf8MEHH3zwwac/n/8DV+pWoZqcUoMAAAAASUVORK5CYII=" alt="" />
1)与hasOwnProperty比较
hasOwnProperty() 方法用来判断某个对象是否含有指定的自身属性。
多了个自身。我的理解就是原型链上的公共属性,判断的时候会返回false。下面所有的代码都可以在线查看到。
function colour() {
this.a = 1;
}
colour.prototype.b = function() {
return 2;
}
var mine = new colour();
console.log("a" in mine);//true
console.log("b" in mine);//true
console.log(mine.hasOwnProperty("a"));//true
console.log(mine.hasOwnProperty("b"));//false
2)用in判断对象属性
in判断的是数组或对象的key属性。数组是一类特殊的对象,数组具有length属性,而对象没有。可参考《对象和数组 (JavaScript)》
var arr = ["a","b","c"];
console.log(0 in arr);//true
console.log(3 in arr);//false
var ob = {0:"a", 1:"b", 2:"c"};
console.log(0 in ob);//true
console.log(3 in ob);//false
上面的代码中数组的key是“0,1,2”与对象的key是一样的。
3)(delete)删除对象的属性
在使用delete后,属性判断都变成了“false”。
var arr = ["a","b","c"];
delete arr[0];
console.log(0 in arr);//false
var ob = {0:"a", 1:"b", 2:"c"};
delete ob[0];
console.log(0 in ob);//false
4)for...in循环
这里用上面示例中的对象mine。
for(property in mine) {
console.log(property);
}
aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAARgAAAAlCAIAAAAWf2EcAAABhklEQVR4nO3bMarCQBRGYdeSasqsIZ2NjYWNkBUoARvBXghYBYOl4BosxBW4ARsLi0BQhBBJLAzC5BUP7Efv8JjH+VbwN4drEuy0AL7W+esBwH9ASIAAQgIEEBIggJAAAWYhxXHseZ7neWEY5nluaRPgnE8uktZ6t9ulaSq+BnCUQUha6+12GwTB71GK49jeLMAtBiFlWTYYDI7HY9u2h8OBkIA3g5DO5/NwOMzz/Hq9TiYTQgLeDEJ6vV7L5VIp1e12F4sFIQFvvP4GBBASIICQAAGEBAjo3AF8jYsECCAkQAAhAQIICRBASIAAQgIEGIRUFEUURUVR2FsDOIqQAAFmIY1GoyRJfN/v9Xqn08neLMAtZiH1+/3NZvN8Pvf7/Ww2a5rG3jLAIR/+tLtcLuPxuCxLa8MAl3wYUpZl0+m0rmtrwwCXGD8j3W63pmnW6/VqtdJa21sGOMQgpKqqoihSSiml5vP54/GwNwtwCx9kAQGEBAggJEAAIQEC+Ks5IICLBAj4Ac7/Q7SuVAQoAAAAAElFTkSuQmCC" alt="" />
将会把上面的一个私有和公有的属性打印出来。这里注意,如果我在对象的公共父级(例如Object)中加个属性,也是会打印出来的。
Object.prototype.z = function() {
};
aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAAOkAAAA3CAIAAABmYfrrAAACCElEQVR4nO3dO6rqUBiGYceSQlI6BjsbQSxsBGsLJWAj2AsBm4hiJYITsLEI9oITsNDCIhC8QPCgQQyB5Sk2pzXLDYvjD+8zgq94WYRcSO4FyJT73wOAX6JdSKXbruu6lmVZltVoNMIwNLoJ0PHZuauU8n1/PB4bWgPo02pXKbVcLovF4s/R67qu6VlAJq12gyCo1Wrb7fb1em02G9rFN9Bq93A41Ov1MAxPp1On06FdfAOtdtM0HY1Gtm2XSqXBYEC7+AbcI4NUtAupaBdS0S6kyv0BZOLchVS0C6loF1LRLqSiXUhFu5BKq90oihzHiaLI9BpAH+1CKt12W63WcDgsFArlcnm/35ueBWTSbbdarc7n8+fzuVqter1ekiSmlwHvfXzNcDwe2+329Xo1PAzI8HG7QRB0u937/W54GJDhg+vdy+WSJMlsNptMJkop08uA97Tavd1ujuPYtm3bdr/fj+PY9CwgE88mIBXtQirahVS0C6n45gdSce5CKtqFVLQLqWgXUtEupKJdSEW7kIp2IZXuO5CVSuXnZxP5fN73fdOzgEyfnbvn89nzPN6BxDf4oN0kSTzP4+dq+BK67SqlFovFer02ugbQp9vubrebTqdpmhpdA+jTajeO42azaf3jOM7j8TC9DHiPe2SQinYhFe1CKtqFVHzzA6k4dyEV7UIq2oVUfwFmPrhKXN38qwAAAABJRU5ErkJggg==" alt="" />
5)巧用in操作
if (value == "a" || value == "b" || value == "c") {
//....
}
//替换为
if (value in {"a":"", "b":"", "c":""}) {
//....
}
参考资料:
http://www.cnblogs.com/ecalf/archive/2012/12/03/2799968.html JavaScript对象及原型继承有关的属性
http://anykoro.sinaapp.com/2012/01/31/javascript%E4%B8%ADfunctionobjectprototypes__proto__%E7%AD%89%E6%A6%82%E5%BF%B5%E8%AF%A6%E8%A7%A3/ Javascript中Function,Object,Prototypes,__proto__等概念详解
http://rockyuse.iteye.com/blog/1426510 理解js中的原型链,prototype与__proto__的关系
http://www.cnblogs.com/snandy/archive/2012/09/01/2664134.html JavaScript中__proto__与prototype的关系
http://www.ruanyifeng.com/blog/2011/06/designing_ideas_of_inheritance_mechanism_in_javascript.html Javascript继承机制的设计思想
http://www.linuxfly.org/post/524/ JavaScript 的in 操作符
JavaScript中typeof、toString、instanceof、constructor与in的更多相关文章
- JavaScript中typeof,instanceof,hasOwnProperty,in的用法和区别
一. typeof操作符 typeof操作符用于返回正在使用值的类型. // 使用原始值 let mNull = null; let mUndefined = undefined; let mStri ...
- javascript中typeof和instanceof用法的总结
今天在看相应的javascript书籍时,遇到了typeof和instanceof的问题,一直不太懂,特地查资料总结如下: JavaScript 中 typeof 和 instanceof 常用来判断 ...
- javascript中typeof与instanceof的区别
JavaScript 中 typeof 和 instanceof 常用来判断一个变量是否为空,或者是什么类型的.但它们之间还是有区别的: typeof typeof 是一个一元运算,放在一个运算数之前 ...
- JavaScript 中typeof、instanceof 与 constructor 的区别?
typeof.instanceof 与 constructor 详解 typeof 一元运算符 返回一个表达式的数据类型的字符串,返回结果为js基本的数据类型,包括number,boolean,st ...
- javascript 中 typeof 和 instanceof 的区别
在 javascript 中经常会用到 typeof 和 instanceof 来判断一个对象的类型,可能 typeof 用得多些,那来看看这两个之间的区别吧. typeof : typeof 是一个 ...
- javascript中 typeof和instanceof的区别
<一> js中typeof的用法进行了详细的汇总介绍 (1)返回一个变量的基本类型 回顾基本类型(number,string,boolean,null,undefined,object) ...
- JavaScript中typeof和instanceof深入详解
这次主要说说javascript的类型判断函数typeof和判断构造函数原型instanceof的用法和注意的地方. typeof 先来说说typeof吧.首先需要注意的是,typeof方法返回一个字 ...
- 浅谈JavaScript中typeof与instanceof的区别
首先,我们从其常规定义入手: instanceof 运算符可以用来判断某个构造函数的 prototype 属性是否存在另外一个要检测对象的原型链上.(需要注意的一点是:prototyp ...
- JS中typeof与instanceof的区别
JavaScript 中 typeof 和 instanceof 常用来判断一个变量是否为空,或者是什么类型的.但它们之间还是有区别的: Typeof typeof 是一个一元运算,放在一个运算数之前 ...
- JS中typeof与instanceof的区别 (2010-05-26 10:47:40
JavaScript 中 typeof 和 instanceof 常用来判断一个变量是否为空,或者是什么类型的.但它们之间还是有区别的: typeof typeof 是一个一元运算,放在一个运算数之前 ...
随机推荐
- 自定义 TableViewCell 的分割线
刚开始自定义 tableViewCell 的时候,用的是直接在 cell 上加一张 imageView 的方法,如果在点击 cell 的时候有页面的跳转,这样做没什么问题,但是,如果在点击 cell ...
- HDU2159 二维完全背包
FATE Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submis ...
- jQuery的几种简单实用效果
许久未分享博客,或许已生疏. 闲来无事, 分享几个jQuery简单实用的效果案例 不喜勿喷... 1.页面常用的返回顶部 <!DOCTYPE html> <html lang=&qu ...
- JDBC的连接和增删改和查找
package Test2;import java.sql.*;import java.sql.DriverManager;import java.sql.SQLException;public cl ...
- ratina 视网膜屏幕解决方案大全
第三方教程 http://www.tuicool.com/articles/JBreIn 知乎 https://www.zhihu.com/question/21653056 强烈推荐!!!最牛逼最专 ...
- requireJs--简单的使用方法
简单使用: <!-- index.html部分 data-main 为入口 --> <script data-main="js/app.js" src=" ...
- Fedora17安装MySQL及配置
一.安装 以下操作均是在root用户下进行操作.首先,如果以前有安装过,这次卸载后安装的话,最好是先将/var/lib/mysql/里面的内容全部删掉(如果不重要的话),我就遇到过没有删除这些东西,结 ...
- tar 命令
tar -cf 打包的文件名 打包的文件 ------tar -cf db.all test.txt (-c 表示建立新的包,-f通常是必选项) tar -tf 打包 ...
- java学习笔记(2)
上篇讲了一些概念之类的知识点,现在继续总结知识点: 1.用户自己在控制面板输入内容是如何实现的:java中有一个类可实现这个功能 类Scanner: import java.util.Scanner; ...
- GIT的认识
说实话,在听到小伙伴们都说赶紧做作业的时候很茫然,连一点头绪都没有,根本不知道从何入手,但不能因为不会就不去做,于是还是拿起手机,找到小伙伴商量着做着,虽然等的过程很焦急,但还是注册成功了.而开始写对 ...