当前位置:网站首页>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>
边栏推荐
- 15.线程同步的几种方法
- Bi skill - judge 0 and null
- 粉丝福利,JVM 手册(包含 PDF)
- Tencent cloud wecity Hello 2022!
- 卷积与转置卷积
- 4年工作经验,多线程间的5种通信方式都说不出来,你敢信?
- 天书夜读笔记——深入虚函数virtual
- Sanic service startup failed
- 2022 crane driver (limited to bridge crane) examination question bank simulated examination platform operation
- Using macro code to generate handwriting automatically in word or WPS
猜你喜欢

Bi-sql create

Zuckerberg demonstrated four VR head display prototypes, and meta revealed the "family" of metauniverse

Bi SQL constraints

2022r1 quick opening pressure vessel operation test questions and answers

Bi-sql select into

15.线程同步的几种方法

Bi-sql delete

Danish Technical University pioneered the application of quantum computing to power flow modeling of energy system

4 years of working experience, and you can't tell the five communication modes between multithreads. Can you believe it?

Cobalt Strike安装教程
随机推荐
This national day! Tencent cloud wecity will accompany you to travel and light up the city landmark
程序员:是花光积蓄在深圳买房?还是回到长沙过“富余”生活?
Scala sample class case calculate
图书馆管理系统代码源码(php+css+js+mysql) 完整的代码源码
Preliminary understanding of qtoolbutton
Scala trait inheritance class
JS Chapter 1 Summary
Bi-sql Union
C语言边界计算和不对称边界
Text border format and text block of rich text
Mysql database Chapter 1 Summary
Text editor for QT project practice - Episode 10
Go语言运算符(第8课下)
汇编语言(3)16位汇编基础框架与加减循环
改造一下 BeanUtils,优雅的实现 List 数据拷贝
LLVM TargetPassConfig
Start service 11111
新手看过来,带你一次性了解“软考”
ContentResolver,拿到手机短信内容
Scala IO reads by lexical units and numbers