FACxBeamery / Week3-toDoList-Thomas-Tom

To Do List project
0 stars 1 forks source link

Methods to concatenate arrays #6

Closed arrested-developer closed 5 years ago

arrested-developer commented 5 years ago

https://github.com/FACxBeamery/Week3-toDoList-Thomas-Tom/blob/a33ce1cffc4c4ed6606165ac1f1f76441e584cbc/src/handler.js#L23

A little test on the node REPL tells me that your output here might not be what you expected. Did you want to return two arrays within another array?

Screen Shot 2019-09-27 at 09 54 55

Take a look at the concat array method. You could also flatten each array using the spread operator

var parts = ['shoulders', 'knees']; 
var lyrics = ['head', ...parts, 'and', 'toes']; 
// ["head", "shoulders", "knees", "and", "toes"]
thomas-galligan commented 5 years ago

Thanks for raising this issue - we're thinking of keeping this structure for now as it means the two parts will be easy to extract (e.g. for filtering out incomplete items), but we'll bare it in mind!