当前位置:网站首页>Record some small requirements in the form of cases
Record some small requirements in the form of cases
2022-07-28 21:36:00 【silence^】
1, With arr As a template ,arr1 It's the random data from the interface , To put arr1 According to arr Sort .
If arr1 There is , and arr Not found in , That is, the new interface , Just line up behind
var arr = ['t1', 't2', 't3', 't4', 't5', 't6', 't7']
var arr1 = ['t5', 'n2', 't3', 'n1','t1']
let temp = arr.filter(item => arr1.includes(item))
let temp1 = arr1.filter(item => !arr.includes(item))
let tempNew = temp.concat(temp1)
console.log(tempNew, 'tempNew') //['t1', 't3', 't5', 'n2', 'n1']0: "t1"1: "t3"2: "t5"3: "n2"4: "n1"length: 5[[Prototype]]: Array(0) 'tempNew'
2, From the key values in the array , Take out the value of the corresponding key , Sum up
var arr=[
{
a:1,b:443,c:12},
{
a:1,b:443,c:12},
{
a:1,b:443,c:12},
{
a:1,b:443,c:12},
{
a:1,b:443,c:12},
]
var arrtemp=[]
arr.map((item)=>{
arrtemp.push(item.b)
})
arrtemp.reduce((p,c)=>{
sum=p+c
return sum
})
console.log(sum)
边栏推荐
- 在子组件中使用el-date-picker报错
- How to select and build the container cloud platform that hosts the key applications of the bank?
- (PMIC)全、半桥驱动器CSD95481RWJ PDF 规格
- Several skills of API interface optimization
- Why on earth is it not recommended to use select *?
- Learning typescript (II)
- Uncaught Error:Invalid geoJson format Cannot read property ‘length‘ of undefind
- Maintenance of delta hot metal detector principle analysis of v5g-jc-r1 laser measurement sensor / detector
- MySQL
- ABB electromagnetic flowmeter maintenance signal transmitter maintenance 41f/e4 technical parameters
猜你喜欢

quii cordova-plugin-telerik-imagepicker插件多图上传乱序

Summary of 29 typical problems in Devops planning and construction of securities enterprises based on containerized PAAS platform

The ref value ‘xxx‘ will likely have changed by the time this effect function runs.If this ref......

如何度量软件架构

Explain C language 12 in detail (C language series)
![Leetcode interview question 02.07. Linked list intersection [knowledge points: Double pointers, stack]](/img/51/ec623bb609f5f57150e7244cf5f9b7.png)
Leetcode interview question 02.07. Linked list intersection [knowledge points: Double pointers, stack]

LeetCode链表问题——142.环形链表II(一题一文学会链表)

LeetCode链表问题——面试题02.07.链表相交(一题一文学会链表)

探讨:想要落地DevOps的话,只考虑好的PaaS容器平台就够了么?

编码用这16个命名规则能让你少写一半以上的注释!
随机推荐
蚂蚁集团境外站点 Seata 实践与探索
百度搜索符合预期,但涉及外链黑帽策略,什么原因?
八、QOS队列调度与报文丢弃
Meta opens the project aria pilot dataset and will develop real-time 3D maps in the future
C process control statement
Maxwell is an easy-to-use software for capturing MySQL data in real time
大学荒废三年,大四自学7个月测试,找到了12K的工作
Quii Cordova plugin telerik imagepicker plug-in multi image upload out of sequence
8、 QoS queue scheduling and message discarding
C语言入门【详细】
国产芯片厂商助力,2020年白牌TWS耳机出货已达6亿部
MySQL 是如何归档数据的呢?
Two excellent software of my love cracking, batch search text, image and video image quality enhancement
30. Learn highcharts label rotation histogram
Adventures of little mouse: behind the scenes gags of moss 2
Bully is filed for bankruptcy! The company has become a "Lao Lai", and the legal person is restricted from high consumption
传微软已获得向华为供货许可!华为将迎来全面解禁?
Redis cache avalanche, cache penetration, cache breakdown
Niuke turns on the camera and the picture disappears a few seconds later | the picture flashes when the camera is turned on
将字符串指针赋值给数组[通俗易懂]