The JavaScript language implements similar effects: 3.grams.flour

Source: Internet
Author: User

The JavaScript language implements similar effects: 3.grams.flour

Reference javascript:the good Parts, 33rd page

The code is as follows:
<body>

<script type= "Text/javascript" >

Copied from page javascript:the good Parts
Function.prototype.method = function (name, func)
{
This.prototype[name] = func;
return this;
}

Number.method (' Chi ', function () {
return this*0.333;
});

Document.writeln ((3). Chi ());
Document.writeln ("<br>");
Document.writeln ((3+1). Chi ());
Document.writeln ("<br>");
Document.writeln (3.2.chi ());
Document.writeln ("<br>");
Document.writeln (3.0.chi ());
Document.writeln (3.chi ());
Syntaxerror:identifier starts immediately after numeric literal

</script>

</body>

The results of the operation are as follows:

0.9990000000000001
1.332
1.0656

0.9990000000000001


Study hard, Kuzhongzuoyue.

The JavaScript language implements similar effects: 3.grams.flour

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.