JSFiddle - React, Tailwind, and code Playground
by humanzing
JavaScript
Array.prototype.indexOfId = function(id) {
for (var i = 0; i < this.length; i++)
if (this[i].id === id)
return i;
return -1;
}
var arrayName =
[{
s: 'ok',
t: [
1668252600, 1668252660,
1668252720, 1668252780,
1668252840, 1668252900,
1668252960, 1668253020,
1668253080, 1668253140
],
c: [
16847.02, 16838.38,
16832.8, 16825.37,
16844.46, 16843.91,
16851.22, 16857.62,
16879.9, 16872.35
],
o: [
16840.1, 16847.02,
16838.99, 16831.84,
16825.1, 16844.46,
16843.91, 16851.21,
16857.62, 16879.75
],
h: [
16850.38, 16847.68,
16839.33, 16834.72,
16847.45, 16857.65,
16857.5, 16870.8,
16887.51, 16886.4
],
l: [
16840.1, 16837.19,
16830.01, 16820.41,
16823.22, 16843.75,
16842.95, 16848.61,
16855.65, 16867.57
],
v: [
39.34476, 48.54743,
137.30687, 91.60759,
95.98467, 198.66054,
107.91118, 113.03053,
156.30228, 98.13625
]
}];
var position = arrayName.indexOfId("v");
alert(position);