js基础-24-伪数组转化为真数组

一,[…arr]

			function fn(){
    
    
				console.log(arguments)
				console.log([...arguments])
			}
			fn(1,2,3,4,5,6,7)

二,Array.from(arr)

			function fn(){
    
    
				console.log(arguments)
				console.log([...arguments])    //[1, 2, 3, 4, 5, 6, 7]
				console.log(Array.from(arguments))   //[1, 2, 3, 4, 5, 6, 7]
			}
			fn(1,2,3,4,5,6,7)

猜你喜欢

转载自blog.csdn.net/weixin_42349568/article/details/109033737
今日推荐