Article View: pl.comp.www
Article #408299Re: Javascript - jak tworzyć obiekty w strict mode?
From: Marek
Date: Sun, 20 Sep 2015 16:48
Date: Sun, 20 Sep 2015 16:48
28 lines
1387 bytes
1387 bytes
W ogóle jest coś nie tak:
function testClass(_data)
{
var data=_data;
testClass.prototype.read=function()
{
console.log("read",data);
};
}
aaa=new testClass(10);
aaa.read();
bbb=new testClass(20);
aaa.read();
daje wynik
10
20
Wygląda na to, że zmienna data staje się globalną z punktu widzenia
testClass!! O co tu chodzi? Albo mnie coś przyćmiło, albo coś porządnie
szwankuje w strict mode.
--
Pozdrawiam,
Marek
Technical Details
Message-ID:
<mtmo0d$75a$1@news.icm.edu.pl>Path:
mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!news.icm.edu.pl!.POSTED!not-for-mailReferences:
<mtlvuv$3t4$1@news.icm.edu.pl> <1fatjmn7yhrh6$.12pek7r1crfbe$.dlg@40tude.net>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!news.icm.edu.pl!.POSTED!not-for-mail From: Marek <precz@spamowi.com> Newsgroups: pl.comp.www Subject: Re: Javascript - jak tworzyć obiekty w strict mode? Date: Sun, 20 Sep 2015 18:48:12 +0200 Organization: ICM, Uniwersytet Warszawski Lines: 28 Message-ID: <mtmo0d$75a$1@news.icm.edu.pl> References: <mtlvuv$3t4$1@news.icm.edu.pl> <1fatjmn7yhrh6$.12pek7r1crfbe$.dlg@40tude.net> NNTP-Posting-Host: 89-69-222-145.dynamic.chello.pl Mime-Version: 1.0 X-Trace: news.icm.edu.pl 1442767693 7338 89.69.222.145 (20 Sep 2015 16:48:13 GMT) X-Complaints-To: usenet@news.icm.edu.pl NNTP-Posting-Date: Sun, 20 Sep 2015 16:48:13 +0000 (UTC) User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:31.0) Gecko/20100101 Thunderbird/31.6.0 In-Reply-To: <1fatjmn7yhrh6$.12pek7r1crfbe$.dlg@40tude.net> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit