标签:efi 键值 def index document find fill nbsp ons
//Array.of() // var arr = new Array(1, 2, 3, 5, 8) // var str = ‘12,3,5,6,ss‘ // console.log(Array.of(str))
<body> <ul> <li>1</li> <li>2</li> <li>3</li> <li>4</li> <li>5</li> <li>6</li> <li>7</li> <li>8</li> </ul> </body> // //Array.from() // let list = document.getElementsByTagName(‘li‘) // var ul = Array.from(list) // console.log(ul)
let arr = [1, 2, 3,4, 5, 6] console.log(arr.find(function (value) { return value > 7; })) //undefined
let arr = [1, 2, 3,4, 5, 6]
console.log(arr.findIndex(function(value){ return value>8; })) //-1
//fill 会改变原数组 let arr1 = [1,2,3,5,9,4] console.log(arr1.fill(3)) //[3,3,3,3,3,3] console.log(arr1) //[3,3,3,3,3,3]
console.log(arr1.fill(4,2,4)) //[3,3,4,4,3,3]
console.log(arr1)
//entries for(let[i,v]of [‘a‘,‘b‘].entries()) { console.log(i,v) } // 0 a
1 b
//keys 索引 for (let index of [‘a‘, ‘b‘].keys()) { console.log(index) } // 0 1
// values 值 for (let value of [‘a‘, ‘b‘].values()) { console.log(value) } // a b
标签:efi 键值 def index document find fill nbsp ons
原文地址:https://www.cnblogs.com/guirong/p/13598620.html