当前位置:网站首页>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>
边栏推荐
- Première application de l'informatique quantique à la modélisation des flux de puissance dans les systèmes énergétiques à l'Université technique danoise
- Bi-sql Union
- Why does Dell always refuse to push the ultra-thin commercial notebook to the extreme?
- Library management system code source code (php+css+js+mysql) complete code source code
- Distinguish between i++ and ++i seconds
- Bi-sql index
- [live review] 2022 Tencent cloud future community city operator recruitment conference and SaaS 2.0 new product launch!
- 图书馆管理系统代码源码(php+css+js+mysql) 完整的代码源码
- Lenovo tongfuyao: 11 times the general trend, we attacked the city and pulled out the stronghold all the way
- Text editor for QT project practice - Episode 10
猜你喜欢

Text editor for QT project practice - Episode 10

15. several methods of thread synchronization

2022 simulated 100 questions of safety officer-c certificate examination and online simulated examination

I brush the question I - copy the linked list with random pointer

程序员:是花光积蓄在深圳买房?还是回到长沙过“富余”生活?

Bi skill - judge 0 and null

Cobalt strike installation tutorial

丹麥技術大學首創將量子計算應用於能源系統潮流建模

Première application de l'informatique quantique à la modélisation des flux de puissance dans les systèmes énergétiques à l'Université technique danoise

扎克伯格上手演示四款VR头显原型机,Meta透露元宇宙「家底」
随机推荐
Mysql database Chapter 1 Summary
腾讯云WeCity解决方案
利用 Redis 的 sorted set 做每周热评的功能
I'd like to ask how to open an account at industrial securities? Is it safe to open a stock account through the link
云开发技术峰会·公益编程挑战赛【火热报名中】!
归并排序求逆序数
Lenovo tongfuyao: 11 times the general trend, we attacked the city and pulled out the stronghold all the way
Leetcode 1248. Statistics of "graceful subarray" (harm, suddenly found that it can only enumerate violently)
Scala sample object
ImageView shows network pictures
Bi-sql top
Convolution and transpose convolution
Text editor of QT project practice ---------- episode 11
图片旋转移动缩放渐变
Convert MySQL query timestamp to date format
Ecological escort cloud service providers wave "Intel flag"
音频PCM数据计算声音分贝值,实现简单VAD功能
生态护航 云服务商挥起“英特尔大旗”
VB 学习笔记
If the order has not been paid for 30 minutes, it will be automatically cancelled. How can I achieve this?