var a = {"a": "17","b": "1","d": "3","v": "10","e": "4","f": "9"};
var b = {"a": "1", "b": "3","d": "4","v": "5", "e": "6","f": "7"};
function search(a, b) {
var result = [];
for(var akey in a) {
var found = false;
for(var bkey in b) {
if (a[akey] == b[bkey]) {
found = true;
continue;
}
}
if (!found) {
result.push(a[akey]);
}
}
return result;
}
console.log(search(a, b));var a = [17, 1, 3, 0, 4, 9];
var b = [1, 3, 4, 5, 6, 7];
function search(a, b) {
var result = [];
for(var i = 0; i < a.length; i++) {
if (b.indexOf(a[i]) == -1) {
result.push(a[i]);
}
}
return result;
}
console.log(search(a, b));
console.log(search(b, a));var a = [17, 1, 3, 0, 4, 9];
var b = [1, 3, 4, 5, 6, 7];
function search(a, b) {
var result = [];
a.forEach(function(v) {
if (b.indexOf(v) == -1) {
result.push(v);
}
});
return result;
}
console.log(search(a, b));
console.log(search(b, a));
var links = document.querySelectorAll(".list__icon");
for(var i = 0; i < links.length; i++)
{
links[i].addEventListener("mouseenter", function()
{
this.classList.add("active");
});
links[i].addEventListener("mouseleave", function()
{
this.classList.remove("active");
});
}
$params = array("{param1}", "{param2}");
$values= array("{values1}", "{values2}");
eval(str_replace($params, $values, file_get_contents("file.php")));
var links = document.querySelectorAll("#uPeople-online a");
var people = document.querySelector("#uPeople");
var link_default = [];
for(var i = 0; i < links.length; i++) {
links[i].addEventListener("mouseenter", function() {
this.appendChild(people);
});
links[i].addEventListener("mouseleave", function() {
this.parentNode.parentNode.insertBefore(people, this.parentNode);
});
}
$replace = array();
if ($settings['music'])
{
$replace['{music}'] = '<embed src="/new.mp3" volume="-300" hidden="true" autostart="true">';
}
else
{
$replace['{music}'] = "";
}
....$tmp = [
'name' => $settings['title'],
'lastBuy' => $lastBuy,
'history' => $history,
'privilege' => $privilege,
'nowDate' => date('o'),
'music' => '<embed src="/new.mp3" volume="-300" hidden="true" autostart="true">',
'admin' => $settings['AdminVkId']
];
$replace = array();
foreach($tmp as $key => $value)
{
if ($settings[$key])
{
$replace["{{$key}}"] = $value;
}
else
{
$replace["{{$key}}"] = "";
}
}
http://www.zazzle.co.uk/rlv/svc/view?rlvnet=1&realview=113966237699778543&design=cee43c30-ea4f-40fc-9087-eaefcb811025&style=hanes_womens_crew_tshirt_5680&size=a_l&color=white&max_dim=512&hide=bleed%2Csafe%2CvisibleMask&r=1451506529663
function A() { }
function B() { }
A();
B();function A()
{
if (smth) return true;
else return false;
}
function B() { }
if (A())
{
B();
}function A()
{
B();
}
function B() { }
A();function A(callback)
{
callback();
}
A(function () { });
// либо
function B() { }
A(B);
Array.prototype.forEach.call(document.querySelectorAll('.link'), function(link)
{
console.log(link);
});
var orig = [2, 2, 5, 6, 5]; // значения которые выпали
var sorted = orig.sort(); // отсортированные значения
// ищем кол-во одинаковых цыфр начиная с переданной позиции
function detect(i, array)
{
var count = 1;
for (; i < array.length - 1; i++)
{
if (array[i] != array[i + 1])
{
break;
}
count++;
}
return count;
}
var index = 0;
var count = 0;
// поиск кол-ва каждой цыфры
while(index < sorted.length - 1)
{
index += count;
count = detect(index, sorted);
console.log(sorted[index] + ": " + count);
}
<center>
<div id="countdown"></div>
<span id="span">remain</span>
</center>
CountDownTimer('<?php echo date("m/d/Y H:i A", time()); ?>', 'countdown');function CountDownTimer(dt, id)
{
var end = new Date(dt);
var _second = 1000;
var _minute = _second * 60;
var _hour = _minute * 60;
var _day = _hour * 24;
var timer;
function showRemaining() {
var now = new Date();
var distance = end - now;
if (distance < 0) {
clearInterval(timer);
document.getElementById(id).innerHTML = 'EXPIRED!';
return;
}
var days = Math.floor(distance / _day);
var hours = Math.floor((distance % _day) / _hour);
var minutes = Math.floor((distance % _hour) / _minute);
var seconds = Math.floor((distance % _minute) / _second);
document.getElementById(id).innerHTML = days + 'days ';
document.getElementById(id).innerHTML += hours + 'hrs ';
document.getElementById(id).innerHTML += minutes + 'mins ';
document.getElementById(id).innerHTML += seconds + 'secs';
}
timer = setInterval(showRemaining, 1000);
}