Department of the afternoon, pick up the Courier Day

Source: Internet
Author: User

Hi!

Today in the Department of the department feel completely without reading the state of the paper, learn something else.

1, JS

-js object Definition and PHP are different, and there are similarities, learning a little meaning, feel good will be very skilled, a bit difficult to get started

<! DOCTYPE html>
<meta http-equiv= "Content-type" content= "text/html; Charset=utf-8 "/>
<title> Date Objects </title>
<script type= "Text/javascript" >

Attributes of DateTime objects
var mydate=new Date ();
document.write ("Current Time:" +mydate+ "<br>");
Mydate.settime (Mydate.gettime () + 60 * 60 * 1000);
document.write ("Delayed two hours:" + mydate);

Properties of a String object

var message= "I Love javascript!";
var mychar= message.tolowercase ();
document.write ("string:" +mychar+ "<br>");

var mystr= "I Love javascript!";
document.write (Mystr.charat (mystr.length-1));//Returns the last character in a string

document.write (Mystr.indexof ("O", Mystr.indexof ("O") +1);//Position The second o appears, no return-1

document.write (Mystr.split ("-") + "<br/>");//String split output
document.write (Mystr.split ("") + "<br/>");
document.write (Mystr.split ("", 3));

document.write (Mystr.substring (Mystr.indexof ("W")) + "<br/>");//extract output some strings
document.write (Mystr.substring (Mystr.indexof ("H"), 5));

document.write (MYSTR.SUBSTR (5) + "<br/>");
document.write (Mystr.substr (0,5));

The following is a mathematical type of object

document.write (Math.ceil (3.3) + "<br/>")//rounding up. Ceil () Note negative numbers
document.write (Math.ceil ( -0.1) + "<br/>")
document.write (Math.ceil ( -9.9) + "<br/>")
document.write (Math.ceil (8.9) + "<br/>")

document.write (Math.floor (3.3) + "</br>")//Down rounding
document.write (Math.floor ( -0.1) + "</br>")
document.write (Math.floor ( -9.9) + "</br>")
document.write (Math.floor (8.9) + "</br>")

document.write (Math.Round (3.3) + "</br>")//rounding
document.write (Math.Round ( -0.1) + "</br>")
document.write (Math.Round ( -9.9) + "</br>")
document.write (Math.Round (8.9) + "</br>")

document.write (Math.Round (Math.random () *10))//random number randomly (), randomly generated 0-1, so 0-100, is behind *100, analogy

Array Object

var myarr1= new Array ("010")//Array link. Concat ()
var myarr2= new Array ("-", "84697581");
document.write (Myarr1.concat (MYARR2))

var myarr1= new Array ("86", "010")//extract array contents to a string,. Join ("string")
var myarr2= new Array ("84697581");
var myarr3= myarr1.concat (MYARR2);
document.write (Myarr3.join ("-"))

document.write (Myarr1.reverse ())//reverse string output. Reverse ()

document.write (Myarr1.slice (-3))//output a series of elements


</script>
<body>
</body>

Department of the afternoon, pick up the Courier Day

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.