$('.plus').click(...)
на $('.rasschet-tbl').on('click', '.plus', ...)
. {
contents: "{\n \"destination_addresses\" : [ \"Kyiv, Ukraine, 02000\" ],\n \"origin_addresses\" : [ \"Luhansk, Luhansk Oblast, Ukraine, 91000\" ],\n \"rows\" : [\n {\n \"elements\" : [\n {\n \"distance\" : {\n \"text\" : \"821 km\",\n \"value\" : 821154\n },\n \"duration\" : {\n \"text\" : \"11 hours 32 mins\",\n \"value\" : 41522\n },\n \"status\" : \"OK\"\n }\n ]\n }\n ],\n \"status\" : \"OK\"\n}\n"
status: {
content_length: 530
сontent_type: "application/json; charset=UTF-8"
http_code: 200
response_time: 330
url: "https://maps.googleapis.com/maps/api/distancematrix/json?origins=Луганск&destinations=Киев&key=AIzaSyCO9I-9cmBpuwUJEdBcNe5F3AGN4iW_Dzs"
}
}
const data = JSON.parse(content.contents);
const obj = {
'anyID2' : {name: 'petya', age: 30},
'anyID1' : {name: 'vasya', age: 20},
'anyID3' : {name: 'kirill', age: 40},
};
const newObj = Object
.keys(obj)
.sort((x, y) => obj[x].age - obj[y].age)
.reduce((acc, key) => { acc[key] = obj[key]; return acc; }, {});
console.log(newObj);
/*
Object { anyID1: {…}, anyID2: {…}, anyID3: {…} }
anyID1: Object { name: "vasya", age: 20 }
anyID2: Object { name: "petya", age: 30 }
anyID3: Object { name: "kirill", age: 40 }
*/
function* generator() {
for (let i = 0; i < 2; i += 1) {
yield i;
}
}
const gen = generator();
console.log(gen.next().value); // 0
console.log(gen.next().value); // 1
console.log(gen.next().value); // undefined
$e = count($d) - 1;
$f = false;
$g = 0;
$h = 0;
if ($c < 0) {
$c = -$c;
$f = true;
}
$i = 2 / (2 + $c);
$j = 4 * $i - 2;
for (; $e > 0; $e--) {
$k = $g;
$g = $j * $g - $h + $d[$e];
$h = $k;
}
$l = $i * exp(-$c * $c + 0.5 * ($d[0] + $j * $g) - $h);
return $f ? ($l - 1) : (1 - $l);