JS (ii) numeric objects and string objects

Source: Internet
Author: User

First, JS function

Because there are more things to learn, easy to confuse. Also can not be remembered, here notes, later to use the time, will be able to quickly recall.

Index-number.js

/** * Display Digital Object */function myFunction () {var x1 = 3.14;//decimal var x2 = 11;//integer var x3 = 14e5;//large number var x4 = 0237;//octal var x5 = 0x12f;//hex 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/>");d ocument.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, Note the case document.write (Str.link ("http://www.baidu.com"));//Click on the link of the content Jump document.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 both the text color and the font size document.write (str3.fontsize (+) + str2.sub () +str3.fontsize (20 ) +str2.sup ());//superscript and subscript document.write (str.replace ("JS", "JavaScript");//Replace}


JS (ii) numeric objects and string objects

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.