Junior — Senior
Working with an array: getting full names, summing salaries, and searching by last name
livecode
Task condition
There is an array of objects, each containing a character's name, gender, surname, and salary. The task is to perform three operations: create an array of strings where each value is the full name (name + space + surname), calculate the total sum of all salaries, and output a list of all records where the surname matches "Rose".
const data = [
{
"charname": "John",
"gender": "Male",
"surname": "Rose",
"salary": 100
},
{
"charname": "Margo",
"gender": "Female",
"surname": "Rose",
"salary": 1200
},
{
"charname": "Lisa",
"gender": "Male", // Possibly a typo? Should it be "Female"?
"surname": "Barcley",
"salary": 1600
}
];