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];

posted @ 2018-09-05 09:59  泡沫幻影  阅读(131)  评论(0编辑  收藏  举报