Lodash的get方法模拟实现
📝
内容提要
function get(obj, path, defaultValue = undefined) { // 如果path是字符串,则将其转为数组 path = typeof path === 'string' ? path.split('.') : path; // 遍历path数组取出obj中对应的值,如果不存在返回defaultValue for (var i =...
➡️