Git Product home page Git Product logo

Comments (3)

huluoyang avatar huluoyang commented on June 19, 2024 4

详细错误请看测试部分。
代码评析:手动标记法的方式未免太繁琐,得转化下思路。
此题考查的是对数组对象的属性和属性值访问。

function lookUp(firstName, prop){
  for(var i=0;i<contacts.length;i++){
    if(contacts[i].firstName == firstName){
      return contacts[i][prop] || "No such property";
    }
  }
  return "No such contact"; 
}

from freecodecamp.cn.

lihaoran111222 avatar lihaoran111222 commented on June 19, 2024 1

.prop换成[prop]就能通过了.

from freecodecamp.cn.

huluoyang avatar huluoyang commented on June 19, 2024 1

是的,弄清楚为什么了吗?
你的方法是手动标记法,未免太繁琐。
但思路是正确的。

from freecodecamp.cn.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.