function some_func_1() {
function inner() {
console.log('hello!');
}
return {inner: inner}
}
some_func_1().inner();
let function_name = 'inner';
some_func_1()[function_name]()
var audio1,audio2;//объекты звуков
function stop_play(){
if(audio1)audio1.stop();//отключаем первый звук если он был
if(audio2)audio2.stop();//отключаем второй звук если он был
audio1=undefined;
audio2=undefined;
}
function play_sound_1(){
stop_play();
audio1 = new Audio ('audio/1.mp3');
audio1.autoplay = true;
}
function play_sound_2(){
stop_play();
audio2 = new Audio ('audio/2.mp3');
audio2.autoplay = true;
}
var polygon = L.polygon([
[51.509, -0.08],
[51.503, -0.06],
[51.51, -0.047]
]).addTo(mymap);
JSON.stringify(polygon.toGeoJSON().geometry.coordinates[0])
"[[-0.08,51.509],[-0.06,51.503],[-0.047,51.51],[-0.08,51.509]]"
var a = [];
mymap.eachLayer(l=>'toGeoJSON' in l && a.push(l.toGeoJSON()));
var result = {"type":"FeatureCollection","features":a};
console.log(JSON.stringify(result,"\n",4))
$.ajax({
...
success: function(data) {
var file=document.createElement('a');
file.href=window.URL.createObjectURL(new Blob([data],{type: "application/pdf"}));
file.download="Report.pdf";
file.click();
}
});
$.ajax({
...
success: function(data) {
chrome.downloads.download({
url : URL.createObjectURL(new Blob([data],{type: "application/pdf"})),
filename : "Report.pdf",
conflictAction : 'uniquify'
});
}
});
[[1,2,3],[4,5,6],[7,8,9]].forEach(
(row,i)=>(
console.log("row = "+i),
row.forEach(
(col,n)=>(
console.log("col = "+n),
console.log(col)
)
)
)
)
var arr = [[1,2,3],[4,5,6],[7,8,9]];
for(let i = 0; i < arr.length ; i++){
for(let n = 0; n < arr[i].length ; n++){
console.log(arr[i][n]);
}
}
button.onclick = () => {
let input = document.querySelector('.u-1').value;
arr1.push(input);
div.innerHTML = arr1;
}
let input = document.querySelector('.u-1');
button.onclick = () => {
arr1.push(input.value);
div.innerHTML = arr1;
}
const arr = [
{ model: '001', param1: 'a1', param2: 'a2', paramN: 'aN' },
{ model: '001', param1: 'b1', param2: 'a2', paramN: 'bN' },
{ model: '001', param1: 'a1', param2: 'a2', paramN: 'cN' },
{ model: '002', param1: 'c1', param2: 'b2', paramN: 'dN' }
];
var param1=[],param2=[];
var _arr=arr.filter(function(e){return !param1.includes(e.param1)&&!param2.includes(e.param2)&¶m1.push(e.param1)&¶m2.push(e.param2)});
[
{model: "001", param1: "a1", param2: "a2", paramN: "aN"},
{model: "002", param1: "c1", param2: "b2", paramN: "dN"}
]
var d = (new Date())-(new Date(2019,8,19));
Math.floor(130/60)
130%60
let a = new Date(2019,8,19,0,0,0).valueOf();//1568836800000
let b = new Date(2019,8,19,1,23,45,678).valueOf();//1568841825678
let c = Math.abs(a-b);//5025678
let millis = c%1000;//678
c=Math.floor(c/1000);//5025
let secs = c%60;//45
c=Math.floor(c/60);//83
let mins = c%60;//23
c=Math.floor(c/60);//1
let hours=c%24;//1
c=Math.floor(c/24);//0
let days = c;//0
new Date((new Date(2019,8,19,1,23,45,678))-(new Date(2019,8,19,0,0,0))).toJSON().split("T")[1]
"01:23:45.678Z"
$('.result').arctext({radius: 400});