标签:rip javascrip pre nbsp 查找 排序 typeof avl ++
var arr= [1,2,3,4]
console.log(typeof(arr))
console.log(arr[0])
for (var i = 0; i < arr.length;i++){
console.log("arr[%d] = %d",i,arr[i])
}
//数值查找数组的位置
var res = arr.indexof(4)
============数组创建================
var arr1= new Array()
console.log(arr1)
var arr1= new Array(1,2,3,"savl")
console.log (arr1)
var arr1= new Array(10)
console.log(arr1)
============排序==================
var arr = new Array(4)
arr[0]=2
arr[1]=1
arr[2]=3
arr[3]= 5
arr[4]=6
arr.sort()
console.log(arr)
标签:rip javascrip pre nbsp 查找 排序 typeof avl ++
原文地址:https://www.cnblogs.com/jeco-li/p/10117025.html