js object-oriented example explanation

小云云
Release: 2018-03-14 16:55:55
Original
1031 people have browsed it

We have shared a lot of knowledge about js object-oriented with you. This article mainly shares with you the explanation of js object-oriented examples, hoping to help everyone.

     
    
Copy after login

1) String: The string can use single quotes or double quotes

1 Find the string in the string: indexOf() There is a return position (starting at 0), if there is no return - 1

2 Content matching: match()

3 Replacement content: replace("original","change")

4 String case conversion toUpperCase()/ toLowerCase()

5 Convert string to array split()

Example:

var str1 = "hello oo"; var s = str1.split(" "); document.write(s[1]);
Copy after login

2) Date

var Date = new Date() ;

document.write(date);

getFullYear() Get the current year

getTime() Get the milliseconds

setFullYear() Set the time

getHours() getMinutes() getSeconds()

     
   

Copy after login

Related recommendations:

JS object-oriented usage examples

js Detailed explanation of object-oriented inheritance knowledge

Detailed explanation of JS object-oriented programming

The above is the detailed content of js object-oriented example explanation. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!