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.
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]);
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()
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!