JS中一些特殊的方法

//用某个字符切割成数组

var str = "obj_str";

var arr = str.split('_');

//arr = ['obj','str'];

//获取对象的属性

YanXG.fileType = {
image: ['jpg','gif','png'],
word: ['doc','docx'],
excel:['xls','xlsx'],
video:['mp4','avi','3gp']
}

var keys = Object.getOwnPropertyNames(YanXG.fileType);

//keys = [image,word,excel,video];

原文地址:https://www.cnblogs.com/yxgmagic/p/9590371.html