当前位置:网站首页>Properties of DOM
Properties of DOM
2022-06-25 01:16:00 【Lutrra】
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<script> // object function Person(name,age){
this.name=name, this.age=age } var obj_2=[{
name:' Li Si ',age:18},{
name:' Wang Wu ',age:18},{
name:' Zhao Liu ',age:18}]; var obj_1=new Person(" Zhang San ",18); console.log(obj_1); for(var i in obj_2){
console.log(obj_2[i].name); } // Built-in objects //1. Mathematical functions var a=Math.PI; console.log(' Mathematical functions :PI:'+a); var b=-1; var number=Math.abs(b); console.log(' Mathematical functions :abs:'+number); var r=Math.random(); console.log(' Mathematical functions :random:'+r); var round=Math.round(a); console.log(' Mathematical functions :round:'+round); var ceil=Math.ceil(a); console.log(' Mathematical functions :ceil:'+ceil); var ceil=Math.floor(a); console.log(' Mathematical functions :floor:'+ceil); // continuity function getTenNumber(){
console.log("------- Consecutive numbers -----------------") console.log('') var num=Math.floor(Math.random()*71+1); for(var i=0;i<10;i++){
num=num+1; console.log(num%71+1); } } getTenNumber(); // Random number var stu=[]; function getNumber(){
//includes push pop console.log("------- Random number -----------------") while(stu.length<10){
var rand=Math.random()*71+1; var result=Math.floor(rand); if(stu.includes(result)){
continue; }else{
stu.push(result) } } stu.forEach(element => {
console.log(element) }); } getNumber(); //2.data var data=new Date(); console.log(data.getFullYear()+' year '); console.log(data.getMonth()+' month '); console.log(data.getDay()+' Japan '); console.log(data.getHours()+' when '); console.log(data.getMinutes()+' branch '); console.log(data.getSeconds()+' second '); console.log(data.getTime()+' And 19 The number of milliseconds from several years '); console.log(data.getDate()+' Days '); console.log(data); console.log("-------------") var data_2=new Date("2021-10-20 00:00:00"); var time=data_2-data; var day=Math.floor(time/1000/60/60/24); var hour=Math.floor(time/1000/60/60%24); var min=Math.floor(time/1000/60%60); var second=Math.floor(time/1000%60); console.log("------- The rest of the time ------") console.log(day+' Japan '+hour+' when '+min+' branch '+second+' second ') // character string var str="abcdefg"; console.log(str.charAt(5))// Subscript to be 5 console.log(str.lastIndexOf('a'));// Retrieve from behind , Return from the past console.log(str.includes('ab')); console.log(str.replace(/a/g,'A')); var str_num="1,2,3,4" console.log(str_num.split(',')); console.log(str.substring(2,5));// Subscript - Where to go? // Array var array_1=[1,2,3,4,5]; array_1.push(6) console.log(array_1); array_1.pop(6) array_1.reverse(); array_1.sort(function (a,b) {
return a-b; // positive sequence });// seeds obj_2.sort(function (a,b) {
return a.age-b.age; }) console.log(obj_2); var str=array_1.join('+'); console.log(str); array_1.forEach(function (item,index) {
console.log(index+''+item); }) array_1.splice(0,2)// In fact, the subscript , How many? , Insert </script>
</body>
</html>
边栏推荐
- Introduction to bi-sql wildcards
- VB learning notes
- Tencent cloud wecity solution
- The optimism about technology is making Dell achieve more than expected
- bindservice方法实现音乐播放暂停
- 腾讯云WeCity丨你好 2022!
- Scala sample class
- How to store dataframe data in pandas into MySQL
- php easywechat 和 小程序 实现 长久订阅消息推送
- 丹麥技術大學首創將量子計算應用於能源系統潮流建模
猜你喜欢

重磅:国产IDE发布,由阿里研发,完全开源!(高性能+高定制性)

Simulation questions and answers of the latest national fire facility operator (senior fire facility operator) in 2022

Text editor for QT project practice - Episode 10

Bi SQL alias

QT electronic clock

JS Chapter 1 Summary

QT (35) - operate excel qxlsx qaxobject

Bi-sql create

Bi-sql top

JVM指令
随机推荐
Rich text tables, lists, pictures
How about compass stock trading software? Is it safe?
汇编语言(2)基础知识-debug
云开发技术峰会·公益编程挑战赛【火热报名中】!
How to store dataframe data in pandas into MySQL
Start service 11111
QT (36) -rapidjson parsing nested JSON
MySQL common basic statements (collation)
使用 Loki 微服务模式部署生产集群
Programmer: did you spend all your savings to buy a house in Shenzhen? Or return to Changsha to live a "surplus" life?
VB 学习笔记
Scala responsibility chain pattern
Using bindservice method to pause music playing
Is it reliable to open an account on the flush with a mobile phone? Is there any hidden danger in this way
Scala sample class case calculate
Scala IO read by line
1. 封装自己的脚手架 2.创建代码模块
丹麦技术大学首创将量子计算应用于能源系统潮流建模
Yasea APK Download Image
Scala classes inherit multiple attributes