const ex = "My favourite game";
console.log(ex.split(' ').map((item) => { return item.split('').reverse().join(''); }).join(' '));
var ex = "My favourite game";
console.log(ex.split(' ').map(function(item) { return item.split('').reverse().join(''); }).join(' '));
$( window ).unload(function() {
console.log(123);
});
window.onunload = function() {
console.log(222);
};
$('.marker').on('click', function() {
var l = $('.content-list');
var right_margin = parseInt($('.content-list-item').css('margin-right'));
var offset = $('.content-list-item').width() * 4 + right_margin * 4 + right_margin;
var current_offset = parseInt(l.css('margin-left'));
if ($(this).hasClass('enabled')) {
l.css('margin-left', (current_offset + offset) + 'px');
} else {
l.css('margin-left', current_offset - offset + 'px');
}
});
$( this ).html($('.inputhiddenlow').val() +'<br> <span style="font-size:10px;"> узнать больше <span>');
var items = [].slice.call(document.getElementsByClassName('item'));
var wrap_size = 4;
var t_arr = [];
for (var i = 0, j = items.length; i < j; i+= wrap_size) {
t_arr.push(items.slice(i, i + wrap_size));
}
document.getElementById('test').innerHTML = '';
for (i = 0; i < t_arr.length; i++) {
var div = document.createElement('div');
document.getElementById('test').appendChild(div);
for(j = 0; j < t_arr[i].length; j++) {
div.appendChild(t_arr[i][j]);
}
}
eval(xmlhttprequest.responseText);
var scr = document.createElement('script');
document.getElementsByTagName('head')[0].appendChild(scr);
scr.text = xmlhttprequest.responseText;
var arr = [
{'uid': '1', 'parentUid': null},
{'uid': '2', 'parentUid': null},
{'uid': '11', 'parentUid': '1'},
{'uid': '12', 'parentUid': '1'},
{'uid': '21', 'parentUid': '2'},
{'uid': '22', 'parentUid': '2'},
{'uid': '13', 'parentUid': '1'},
{'uid': '23', 'parentUid': '2'},
{'uid': '231', 'parentUid': '23'},
{'uid': '232', 'parentUid': '23'},
{'uid': '111', 'parentUid': '11'},
{'uid': '112', 'parentUid': '11'},
{'uid': '1111', 'parentUid': '111'}
];
arr.sort(function(a,b){
return Number(a['parentUid']) - Number(b['parentUid']);
});
console.log(arr);