Entries

〔俗〕你真的了解JavaScript吗? / Ju rly understand JavaScript!?

var s1 = "Kaneiyuki", s2 = String("ScriptBusy"), s3 = new String("Shinron");
s1.p = {}; s2.p = {}; s3.p = {};
var arrTestResult = [
[typeof s1, typeof s2, typeof s3],
[s1 instanceof String, s2 instanceof String, s3 instanceof String],
[s1 instanceof Object, s2 instanceof Object, s3 instanceof Object],
[s1.p, s2.p, s3.p]];

document.write(arrTestResult);

document.writeln("<br />");

function kaneiyuki(){
this.p = { n: "nan" };
}

function scriptbusy(){
}

function shinron(){
return new kaneiyuki;
}

scriptbusy.prototype = new kaneiyuki;

var kanei = new scriptbusy, yuki = new shinron;

(scriptbusy.prototype = new kaneiyuki).additional = true;

var arrTestResult = [
[kanei.p, kanei instanceof kaneiyuki, kanei instanceof scriptbusy, kanei.constructor],
[yuki.p, yuki instanceof kaneiyuki, yuki instanceof shinron, yuki.constructor],
yuki.additional];

document.write(arrTestResult);


document.writeln("<br />");

function shinronyo(){
this.randomMember = "shinrondesune";
return this.randomMember;
}

var oshinron = new shinronyo, sshinron = shinronyo();

var arrTestResult = [
[typeof oshinron, typeof sshinron],
[oshinron.constructor, sshinron.constructor],
[oshinron.randomMember, sshinron.randomMember],
[oshinron, sshinron]];

document.write(arrTestResult);


document.writeln("<br />");

function k(){this.a={}};
function n(){k.call(this)};
n.prototype=new k;
var e=new n;
n.prototype.i=9;

document.write([e instanceof n, e instanceof k, n.prototype.a, e.a == n.prototype.a, e.i]);



当然,本篇是只给能看懂的人看的……
For sure, this post is only for Pros...

不过……
But...
谁来帮帮我……
Can any1 help me...

我不行了……
I am badly being...
/敲桌 233 Max
/knockondesk /ROFLMFAO
引用此文章(FC2博客用户)
http://shinron4.blog126.fc2blog.us/tb.php/18-2b7424ba

引用

留言

发表留言

发表留言
只对管理员显示

Appendix

自我介绍

优雅的神棍 / Elegant Tales

Author:优雅的神棍 / Elegant Tales
神棍你好,神棍再见。

最新引用

QR

QR

羔羊们啊

加为好友

和此人成爲好友

搜寻栏