Skip to content

[js]对象属性检索 #18

@VaJoy

Description

@VaJoy

判断对象是否存在某属性,若有则返回属性值,否则返回undefined

  • 示例:
    var o = {
      a : {
        b : {
          c : 11
        }
      },
      b : 2
    };
    Object.prototype.hash = function(attr){
      //TODO: 完成该方法
    };
    o.hash('a.b.c');  //11

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions