function getPropByPath(obj, path) { let tempObj = obj; path = path.replace(/\[(\w+)\]/g, '.$1'); path = path.replace(/^\./, ''); let keyArr = path.split('.'); let i = 0; for (let len = keyArr.length; i < len - 1; ++i) { let key = keyArr[i]; if (key i…
JS对象—数组总结(创建.属性.方法) 1.创建字符串 1.1 new Array() var arr1 = new Array(); var arr2 = new Array(6); 数组的长度为6 var arr3 = new Array(1, 2, 3, 4); 括号中的元素为数组的项, length为元素个数 1.2 [] (简写) var arr4 = [1,2,3,4] 2.数组的属性 2.1 constructor 对创建数组对象的Array构造函数的引用, 2.…