当前位置:网站首页>冒泡排序函数封装
冒泡排序函数封装
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.运行结果

边栏推荐
- 【解决】win10下emqx启动报错Unable to load emulator DLL、node.db_role = EMQX_NODE__DB_ROLE = core
- uni-app项目总结
- uni-app project summary
- MLX90640 红外热成像仪测温模块开发笔记(完整版)
- Multi-feature fusion face detection based on attention mechanism
- 具有通信时延的多自主体系统时变参考输入的平均一致性跟踪
- Trie详解
- Don't know about SynchronousQueue?So ArrayBlockingQueue and LinkedBlockingQueue don't and don't know?
- What is it like to trade for a living?
- String splitting function strtok exercise
猜你喜欢

IP Core: FIFO

已知中序遍历数组和先序遍历数组,返回后序遗历数组

MLX90640 红外热成像仪测温模块开发笔记(完整版)

【HCIP】BGP小型实验(联邦,优化)

Quick solution for infix to suffix and prefix expressions

When Netflix's NFTs Forget Web2 Business Security

These 4 computer notepad software, you have to try

Business test how to avoid missing?

C language character and string function summary (2)

Using the "stack" fast computing -- reverse polish expression
随机推荐
Transient Stability Distributed Control of Power System with External Energy Storage
Arduino 基础语法
poker question
基于数据驱动的变电站巡检机器人自抗扰控制
构造方法,this关键字,方法的重载,局部变量与成员变量
JSP如何使用request获取当前访问者的真实IP呢?
Disk and file system management
ROS dynamic parameters
Automatic conversion of Oracle-style implicit joins to ANSI JOINs using jOOQ
els block boundary deformation processing
工业信息物理系统攻击检测增强模型
基于注意力机制的多特征融合人脸活体检测
els 方块变形判断。
基于编码策略的电网假数据注入攻击检测
Routing strategy
nodeJs--mime module
IO流基础
How to design a circular queue?Come and learn~
不了解SynchronousQueue?那ArrayBlockingQueue和LinkedBlockingQueue不会也不知道吧?
Are test points the same as test cases?