JS (2) numeric and string objects, and js numeric object strings

Source: Internet
Author: User

JS (2) numeric and string objects, and js numeric object strings

I. js Functions

It is easy to confuse because many things are learned. It is impossible to remember them one by one. Here, we will be able to quickly review them when using them in the future.

Index-number.js

/*** Display numeric object */function myFunction () {var x1 = 3.14; // fractional var x2 = 11; // integer var x3 = 14e5; // big numeric var x4 = 0237; // octal var x5 = 0x12f; // hexadecimal var y = 0.1 + 0.2; var str = "x1: "+ x1 +" <br/> x2: "+ x2 +" <br/> x3: "+ x3 +" <br/> x4: "+ x4 +" <br/> x5: "+ x5; document. write (str + "<br/>"); document. write (y);}/*** display String object */function myFunction2 () {var str = "<p> This is the text content of the js object </p> "; var str2 = "Black"; var str3 = "this is the text content of the js object" document. write (str. italics (); // The text is italic document. write (str. fontcolor ("# ff0000"); // The text color is red. Pay attention to the case of document. write (str. link ("http://www.baidu.com"); // click the link document to jump to the content. write (str. bold (); // The text is in bold document. write (str2.toLocaleLowerCase (); // lowercase document. write (str2.toUpperCase (); // uppercase document. write (str. fontcolor ("red "). fontsize (20); // change the text color and font size at the same time. document. write (str3.fontsize (20) + str2.sub () + str3.fontsize (20) + str2.sup (); // superscript and subscript document. write (str. replace ("js", "JavaScript"); // replace}


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.