当前位置:网站首页>冒泡排序函数封装
冒泡排序函数封装
2022-08-02 00:13:00 【Slxa 安.】
目录
1.js代码
function maoPao(arr){
for(i=0;i<=arr.length;i++){
for(j=0;j<=arr.length;j++){
if(arr[j]>arr[j+1]){
var temp=arr[j];
arr[j]=arr[j+1];
arr[j+1]=temp;
}
}
}
return arr;
}
result=maoPao([3,5,6,2]);
console.log(result);2.运行结果

边栏推荐
猜你喜欢
随机推荐
基于数据驱动的变电站巡检机器人自抗扰控制
Stapler:1 靶机渗透测试-Vulnhub(STAPLER: 1)
攻防世界-web-Training-WWW-Robots
Automatic conversion of Oracle-style implicit joins to ANSI JOINs using jOOQ
JSP如何使用page指令让JSP文件支持中文编码呢?
poker question
Web开发
Cyber-Physical System State Estimation and Sensor Attack Detection
AXI4协议介绍
不要用jOOQ串联字符串
unity2D横版游戏教程5-UI
nodeJs--mime module
Mean Consistency Tracking of Time-Varying Reference Inputs for Multi-Agent Systems with Communication Delays
【HCIP】BGP小型实验(联邦,优化)
基于注意力机制的多特征融合人脸活体检测
玩转NFT夏季:这份工具宝典值得收藏
Kunpeng compile and debug plug-in actual combat
els block deformation judgment.
Short video seo search optimization main content
IO stream basics








