I need to find my value in a range of key-values in an array of objects. And then perform some math on the object that matches the criteria.
const array-of-objects = [
{w1: 0.1, w2 0.5, Jv1: 6.13, Jv2: 2.75, a: 3.89},
{w1: 0.5, w2 2, Jv1: 2.75, Jv2: 1.36, a: 3.54},
{w1: 2, w2 4, Jv1: 1.36, Jv2: 0.95, a: 3.57},
{w1: 4, w2 9.63, Jv1: 0.95, Jv2: 0.55, a: 3.5},
{w1: 9.63, w2 35, Jv1: 0.55, Jv2: 0.3, a: 3.5},
{w1: 35, w2 78.03, Jv1: 0.3, Jv2: 0, a: 3.5}]
My pseudo code
const look-up-val = 3;
if (array-of-objects.w1=<look-up-val=<array-of-objects.w2)
const m = Math.log(array-of-objects.w2/array-of-objects.w1) / Math.log(array-of-objects .Jv2/array-of-objects.Jv1);
const b = Math.log(array-of-objects.a);
const logJv = m*Math.log(look-up-val)+b;
const Jv = 10^logJv
I tried
const a = [{s: 3, d: 6, q: 33}]
<-undefined
if (a.s<=5>=a.d) {console.log(a.q)}
<-undefined
and get lost.