Extract certain properties from all objects in array

Use object destructuring to get the properties, and generate a new object using shorthand property names: const dummyArray = [{ “att20”: “att20”, “att30”: “att30”, “att70”: “att70”, “att80”: “att80”}, { “att20”: “att20”, “att30”: “att30”, “att70”: “att70”, “att80”: “att80”}]; const result = dummyArray.map(({ att20, att30, att70, att80 }) => ({ att20, att30, att70, att80 })); console.log(result);

Correlation of two arrays in C#

You can have the values in separate lists at the same index and use a simple Zip. var fitResult = new FitResult(); var values1 = new List<int>(); var values2 = new List<int>(); var correls = values1.Zip(values2, (v1, v2) => fitResult.CorrelationCoefficient(v1, v2)); A second way is to write your own custom implementation (mine isn’t optimized for … Read more