在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
例子 <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>Object.keys()处理对象,返回可枚举的属性数组</title> </head> <body> <script type="text/javascript"> let person={ name:'一只流浪的kk', age:20, eat:function(){} } console.log(Object.keys(person));// ['name','age','eat'] </script> </body> </html>
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>Object.keys()处理数组,返回索引值数组</title> </head> <body> <script type="text/javascript"> let arr=[1,2,3,4,5]; console.log(Object.keys(arr));//['0','1','2','3','4','5'] </script> </body> </html>
|
请发表评论