当前位置:网站首页>2022.2.12
2022.2.12
2022-07-06 18:46:00 【z318969887】
Insert delete array elements
// It can only be inserted and deleted from the tail arr.push(0);//push, write in , That is, insert the element in parentheses in the last position of the array , Numbers without quotation marks , Characters with quotation marks arr.pop();//pop, Delete , Delete the last element in the array , There is no need to fill in the brackets ,pop You can only delete one by one// It can only be inserted and deleted from the head arr.shift(1);// Insert... From the head , Be similar to push arr.unshift();// Remove... From the head , Be similar to popSort
arr.sort();//sort The function is to sort , There is no need to enter a value in bracketsElement inversion
arr.reverse();// Arrange all the elements in the array in the reverse order of the current orderLink string
arr.concat(arr1);// In brackets , If it is an array variable, fill in the variable name directly , If it's a hashed element , Then add brackets ; notes :concat The array is not modified , Only a new array is returnedConnector
arr.join('-');// Fill in the brackets with what you want to connect , Just a style , Output is as follows : arr.join('-') '0-7-5-2-3-1-6-4-9'// notes : Quotation marks must be added in bracketsMultidimensional arrays
arr = [[x,x,···],[x,x,···],[x,x,···]];// Multidimensional array is the nesting of arrays console.log(arr[1][1]);// Use the subscript of multidimensional array to get
5、 object
Several key value pairs
'use strict'; let person = { name:"zhangsan", age:3, email:"[email protected]", score:0 }// Define an object , Its content “name”、“age” Etc. are the properties of the object , The type of attribute is string typeObject Assignment
person.name = "lisi";// Assignment of elements in the object person.age;// Output the value of the corresponding attribute of the objectIf you use a nonexistent object, there will be no error , Will be output “undefined”
Delete properties dynamically
delete person.name;// Whether it exists or not, it will return a true, When the deleted attribute is output again undefinedAdd properties dynamically
person.sex = "man";// Directly add violenceDetermine whether the property value is in the object
'score' in person;// The format is xxx attribute in xxx object true 'toString' in person;// inheritance , The properties of the parent class can also be found in this object trueDetermine whether a property is owned by the object itself
person.hasOwnProperty('age');
边栏推荐
- Method of accessing mobile phone storage location permission under non root condition
- If you have any problems, you can contact me. A rookie ~
- Execution process of MySQL query request - underlying principle
- Installation and management procedures
- [sword finger offer] 60 Points of N dice
- Penetration test information collection - App information
- MySQL查询请求的执行过程——底层原理
- 2022/02/12
- 重磅硬核 | 一文聊透对象在 JVM 中的内存布局,以及内存对齐和压缩指针的原理及应用
- STM32+MFRC522完成IC卡号读取、密码修改、数据读写
猜你喜欢

Execution process of MySQL query request - underlying principle

Use cpolar to build a business website (1)

Easy to use PDF to SVG program
![[.Net core] solution to error reporting due to too long request length](/img/62/6bdc43885f9be3fa4538276c0dc122.png)
[.Net core] solution to error reporting due to too long request length
![Estimate blood pressure according to PPG using spectral spectrum time depth neural network [turn]](/img/f2/194ae452609d3e474b7b580d61bf4f.png)
Estimate blood pressure according to PPG using spectral spectrum time depth neural network [turn]
![Noninvasive and cuff free blood pressure measurement for telemedicine [translation]](/img/56/8deaec18cd9f2cf49ff234b09b1283.png)
Noninvasive and cuff free blood pressure measurement for telemedicine [translation]

Jushan database was among the first batch of financial information innovation solutions!

Blue Bridge Cup real question: one question with clear code, master three codes

Docker installation redis

用于远程医疗的无创、无袖带血压测量【翻译】
随机推荐
CSRF漏洞分析
The role of applet in industrial Internet
MySQL查询请求的执行过程——底层原理
华为0基金会——图片整理
AcWing 3537. Tree lookup complete binary tree
Installation and management procedures
手写一个的在线聊天系统(原理篇1)
Test 1234
How are you in the first half of the year occupied by the epidemic| Mid 2022 summary
Using block to realize the traditional values between two pages
Crawling data encounters single point login problem
44 colleges and universities were selected! Publicity of distributed intelligent computing project list
Stm32+mfrc522 completes IC card number reading, password modification, data reading and writing
Hongke shares | plate by plate ar application in Beijing Winter Olympics
解读云原生技术
上海部分招工市场对新冠阳性康复者拒绝招录
巨杉数据库首批入选金融信创解决方案!
Penetration test information collection - basic enterprise information
Some understandings of tree LSTM and DGL code implementation
裕太微冲刺科创板:拟募资13亿 华为与小米基金是股东