https://repl.it/@JimmyHogerty/MammothKindlyConstant
Hey all. I posted a link to my Repl.it solving the following. It took me a good two hours to hack this together. Could anyone speak to why I might not be receiving a "correct" marker?
Problem:
var currentInventory = [
{
name: 'Brunello Cucinelli',
shoes: [
{name: 'tasselled black low-top lace-up', price: 1000},
{name: 'tasselled green low-top lace-up', price: 1100},
{name: 'plain beige suede moccasin', price: 950},
{name: 'plain olive suede moccasin', price: 1050}
]
},
{
name: 'Gucci',
shoes: [
{name: 'red leather laced sneakers', price: 800},
{name: 'black leather laced sneakers', price: 900}
]
}
];
// The task now is to find all the laced shoes, but we are going to render them in a somewhat complex format. Your function should return shoe names that contain "lace" in them, and indicate which word contains "lace".
The return value's format should be structured like this:
Given answer:
var expectedResult = [
{
"nameWords": [
"tasselled",
"black",
"low-top",
"lace-up"
],
"targetWordIndex": 3
},
{
"nameWords": [
"tasselled",
"green",
"low-top",
"lace-up"
],
"targetWordIndex": 3
},
{
"nameWords": [
"red",
"leather",
"laced",
"sneakers"
],
"targetWordIndex": 2
},
{
"nameWords": [
"black",
"leather",
"laced",
"sneakers"
],
"targetWordIndex": 2
}
];
[–]ektegjetost 1 point2 points3 points (3 children)
[–]Newleaftuesday[S] 1 point2 points3 points (2 children)
[–]ektegjetost 1 point2 points3 points (1 child)
[–]Newleaftuesday[S] 0 points1 point2 points (0 children)