7 kyu

getNames()

7,554 of 9,621jhoffner

Description:

The following code is not giving the expected results. Can you debug what the issue is?

The following is an example of data that would be passed in to the function.

var data = [
  {name: 'Joe', age: 20},
  {name: 'Bill', age: 30},
  {name: 'Kate', age: 23}
]

getNames(data) // should return ['Joe', 'Bill', 'Kate']
public class Person
{
  public int Age;
  public string Name;

  public Person(string name = "John", int age = 21)
  {
    Age = age;
    Name = name;
  }
}

Person[] data = new Person[]
{
  new Person("Joe", 20),
  new Person("Bill", 30),
  new Person("Kate", 23)
};

Kata.GetNames(data) => new string[] {"Joe", "Bill", "Kate"};
(def data [
  {:name "Joe" :age 20}
  {:name "Bill" :age 30}
  {:name "Kate" :age 23}
])

(get-names data) ; should return ["Joe" "Bill" "Kate"]
data = [
    {'name': 'Joe', 'age': 20},
    {'name': 'Bill', 'age': 30},
    {'name': 'Kate', 'age': 23}
]
get_names(data) # should return ['Joe', 'Bill', 'Kate']
Debugging

Stats:

CreatedMar 21, 2013
PublishedMar 21, 2013
Warriors Trained14102
Total Skips758
Total Code Submissions25721
Total Times Completed9621
JavaScript Completions7554
C# Completions797
Clojure Completions46
Python Completions1213
Total Stars53
% of votes with a positive feedback rating84% of 1035
Total "Very Satisfied" Votes770
Total "Somewhat Satisfied" Votes207
Total "Not Satisfied" Votes58
Ad
Contributors
  • jhoffner Avatar
  • Unnamed Avatar
  • sprengerjo Avatar
  • Blind4Basics Avatar
  • Voile Avatar
  • Souzooka Avatar
  • Bubbler Avatar
  • hobovsky Avatar
  • Kacarott Avatar
Ad